Academic Company Events NI Developer Zone Support Solutions Products & Services Contact NI MyNI
This Document is not yet Rated  Rate this Document

Pulsed vs Toggled Output Modes using Counter Hardware

Primary Software: Driver Software>>NI-DAQ
Primary Software Version: 7.4.4
Primary Software Fixed Version: N/A
Secondary Software: Driver Software>>NI-DAQ, Driver Software>>NI-DAQmx
Hardware: Counter/Timers (TIO)

Problem:
What is the difference between pulsed and toggled output modes as used by counters?

Solution:
To properly understand toggled output and pulsed output modes, it helps to first briefly review how a counter generates a pulse.

A counter typically has two load registers (load register A and B) that determine the characteristics of its pulse. These load registers can each be configured with a minimum value of 2. With DAQmx, the registers are configured automatically by setting the duty cycle and frequency of your task. (For more information, see the PWM-Counter Output.vi DAQmx shipping example and/or KnowledgeBase 3PQEQNTJ: How Do I Scale the Frequency of a Square Wave in DAQmx?). With the Traditional DAQ driver, you specifically set the values to be placed in the load registers. To do this you call the PCTR_Change Parameter function in C or the Counter Set Attribute.vi in LabVIEW (These commands are shown again below). The key parameters are "pulse spec 1" (load register A, which typically stores the number of clock pulses for the delay) and "pulse spec 2" (load register B, which typically stores the number of clock pulses for the pulse).

When you start the counter, the first load register (A) is loaded into the counter, and every time a rising edge occurs on the source, the count in the load register decreases by one. When that count reaches zero, the counter can do one of two things: (1) the output can toggle from low to high or (2) it can output a pulse that is equal to one period of the source. The first mode is called "toggled output" and the second is called "pulsed output". The following figure, seen in the 6601/6602 User Manual, shows the two output modes for a pulse generation with a delay of two and a pulse width of four:

Additionally, after load register A reaches zero, load register B is loaded. When load register B reaches zero, the output of the counter will either toggle or generate a pulse depending on the selected output mode. In this example say the source has a period of 10ns. Therefore, in toggled mode, the output signal has a period of 60ns and the pulse width is 20ns. In pulsed output mode, the signal has two 10ns pulses that occur with 10ns and then 30ns between concurrent pulses.

If the two load registers are configured with the same value in each, then in either mode, the output will be a frequency output signal with a 50% duty cycle.

You configure the output mode different ways depending on whether you use NI-DAQmx or Traditional NI-DAQ (legacy).

  • NI-DAQmx
    • LabVIEW: DAQmx Export Signal Property Node (CtrOutEvent.OutputBehavior property)
    • C/CVI: DAQmxSetExportedCtrOutEventOutputBehavior()
  • Traditional DAQ
    • LabVIEW: Counter Set Attribute.vi ("output mode" attribute)
    • C/CVI: GPCTR_Change_Parameter()


Related Links:
KnowledgeBase 3PQEQNTJ: How Do I Scale the Frequency of a Square Wave in DAQmx?
KnowledgeBase 1TRA8L00: Maximum Output Frequency for 6601/6602 Counter/Timer Boards
Products & Services: Counter/Timer Devices

Attachments:





Report Date: 08/06/2008
Last Updated: 11/07/2008
Document ID: 4O5AQASD

Your Feedback! poor Poor  |  Excellent excellent   Yes No
 Document Quality? 
 Answered Your Question? 
  1 2 3 4 5
Please Contact NI for all product and support inquiries.submit