Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

synchronized counting

Hello everyone!

 

I have the following at hand:

 

I am working with NI PXIe-6361 X series Multifunctional DAQ and to it is connected SCB-68 I/O box.  I also have TDC (sync) and CAD pulses from a testbench engine, which I would like to connect to the I/O box and do a synchronized edge counting of the CAD pulse. For example if I have 360 pulses of CAD in between two TDC pulses, I'd like to count from 0 upwards to 360 from the first detection of TDC pulse. How can I come across this problem I am facing? Which help examples are also good to start looking at?

 

Thanks

 

/Henok

 

0 Kudos
Message 1 of 4
(4,667 Views)

Assuming the signals are TTL (if they're not you would need to translate them), you'll want to use a counter input task to do this.  Here are two different ways you could configure it:

 

1.  Sample-clocked edge count task:  Use your TDC signal as the "sample clock" and the CAD signal as the source of edges to count ("Input Terminal" on the linked example).  The counter will keep a running total of edges from the time it is armed (can be triggered with a hardware signal if desired), and the count will be latched into a buffer every time a clock edge is received.  Your sampled data would look like:  [360, 720, 1080...]

 

2.  Implicitly-timed period measurement task:  Use your TDC as the Input Terminal for the period measurement task.  You'd have to add a DAQmx Channel Property Node to specify to use the CAD signal as the counter timebase source.  The counter will measure the time between successive edges of the TDC signal in terms of ticks of the CAD signal.  Your sampled data would look like: [360, 360, 360 ...].

 

 

Either configuration is probably fine (whichever makes the most sense to you).  Be aware that #2 will only start sampling data after the 2nd edge of the TDC signal, where as #1 will sample data on the very first edge after the counter is armed.  The counter rolls over at a count of 2^32, so if you plan on running for a long time (definition of "long time" depends on the rate of your CAD signal) using #1 you should handle rollovers in software.

 

 

 

Best Regards,

John Passiak
Message 2 of 4
(4,656 Views)

Hi Henok,

 

I just sent your colleague the example code to get this DO signal you actually wanted to send out to work as intended. I will attached the code so other people here on the forum can see it.example.JPG

The counter task is just there to count the actual revolutions the engine has done.

Best Regards
Jonas Mäki
Systems Developer
Novator Solutions
0 Kudos
Message 3 of 4
(4,637 Views)

I hit the send button a little to early, I never explained the example.

 

So this example will generate a digital pulse according to specified array everytime you get a CAD pulse if you connect that wire to configured pin. It will also count every time TDC (revolution puls) goes high and will reset when it reaches the count of 1000 or what ever value you specify.

Best Regards
Jonas Mäki
Systems Developer
Novator Solutions
0 Kudos
Message 4 of 4
(4,636 Views)