Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

Start and Stop of a Digital Pulse (DAQmx example)

Hi Claudio,
I looked at the code you sent, and it seems to be working properly. When the counter reaches the termination count (TC), it resets, and it triggers the stop condition on the while loop ending the VI's execution. The data value output at the end of the VI's execution will vary based on the amount of time that it takes the while loop to end its execution. Since the while loop runs on the processor, this time will vary. Having the VI stop and the count reset assures us that the counter correctly recognizes the TC. The software delay in stopping the while loop prevents us from seeing the termination count on the data output.

Hope this helps.
Marcus G.
National Instruments
0 Kudos
Message 11 of 16
(1,638 Views)
You are correct Kevin. In traditional DAQ you could not have a triggered continuous pulse generation. In mx though, you can have a start trigger for a continuous pulse generation. This applies to both E-Series and TIO counters.
0 Kudos
Message 12 of 16
(2,324 Views)
Just a quick note: the reply from Marcus was right -- the program behaves as it should. However, I'm not sure you're approaching the "TC pulse" concept the right way to implement Justin's idea.

Your program uses software polling to query for the 'TC reached' condition. Note also that your polling loop cycles without any delays inside. That'll tie up your CPU while waiting for TC.

Justin's idea uses the hardware pulse signal that the counter generates on its output pin when it reaches TC. That provides a finer resolution and more precise timing signal to use for the rest of your task, plus no CPU-bound polling is needed.

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
0 Kudos
Message 13 of 16
(1,638 Views)
you'r right kevin
everything works fine now
best regards and really thanks for all the suggestions
-Claudio
0 Kudos
Message 14 of 16
(1,638 Views)
kevin
I was checking the TC output pulse from a counter. I've made two simple vi (one counts a train on the input of counter 0 until it reaches TC; the other vi counts on counter 2, the output of counter 0). In this way I should see every time I reach TC an increment (or decrement depending on the setting) on the counts of counter 2. But in fact nothing is happening. I use a 6601 (but the same happens with 6110) and the input train pulse on counter 0, has a frequency of 10KHz, pulsewidth 1 microsecond.
Do you know where is the error?
Best reagrds and thansk
-Claudio
Download All
0 Kudos
Message 15 of 16
(1,638 Views)
I didn't see anything in the program to tell "counter 2" what signal to count edges on. By default, it will look to its source pin, meaning that you would have needed to physically wire the output of counter 0 to the source of counter 2.

I made a couple mods to your vi's, adding DAQmx channel property nodes to each. The channel property node allows you to specify the source signal for the edges programmatically, without any screwdriver & wiring work.
To test it out, I let the first counter count the internal 20 MHz timebase, and no longer stop it when the software detects 'TCreached'. It simply keeps rolling over (and pulsing) a bit more than once a second.
The second counter
is now configured to count the TC pulse generated by the first counter. Now you'll see it decrement on each pulse.

Note that you may need to change back the device and counter # designations. I had to change them to work with the hardware I have available.

-Kevin P.
ALERT! LabVIEW's subscription-only policy came to an end (finally!). Unfortunately, pricing favors the captured and committed over new adopters -- so tread carefully.
Download All
0 Kudos
Message 16 of 16
(1,638 Views)