Counter/Timer

cancel
Showing results for 
Search instead for 
Did you mean: 

high speed count using C

Hi there,

I am trying to generate 2 square waves (2 MHz max.) with 90 deg. shift using my 6024E card. I use both counters on the card, one to generate pulses (at certain frequency) and the other to count the generated pulses. Based on the count, I am able to generate the square waves via digital output ports. However, this only works at low frequencies but not at high frequencies since the program loop misses some of the count (I believe). Can anybody suggest me how I can overcome this problem. In addition to that, I might also need to produce another 3 pairs of similar waves at different frequency simultaneously. I don't mind buying additional or more suitable card.(I am using C language for my programming).

Thank you for any suggestion.

0 Kudos
Message 1 of 2
(3,175 Views)
Hello;

That is happening because you are doing Software timed operation, and since Windows manages all tasks that runs on the machine at any given time, your VI might take different times to execute, and that might be enough for you to miss some pulses.

The best way to do that is by using a 660x board, and have three counters doing the job. The firts counter can be configured as the first pulse train generator, the second counter can be used to generate a pulse that will trigger the third counter of. That pulse will be generated when the delay of 90 degrees is reached. So, the second counter will count events and will be triggered of by the pulse train generated by the first counter.

The third counter is configured as triggered pulse train generator, and t
he output pulse of the second counter is used as the trigger pulse for the third counter.

If you don't use that approach, you won't be able to reach fast speeds and might also miss some pulses, due to the Software timed approach.

Hope this helps.
Filipe A.
Applicaions Engineer
National Instruments
0 Kudos
Message 2 of 2
(3,175 Views)