Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

How can I program a counter to counts the input pulse, if the counter reach to 100 then output a pulse.

How can I program a counter to counts the input pulse, if the counter reach to 100 then output a pulse and the counter continue.
0 Kudos
Message 1 of 5
(3,142 Views)
Well, it depends on which counter you are using. If you are using an STC counter as on the E-Series boards, you're options are limited

You could configure it for continuous pulse generation (use the Generate Pulse Train example VI) and program the raw pulse specs to be low for 98 source edges and high for 2 source edges. (Each pulse spec must be at least 2 so the pulse will have to remain high for 2 source edge durations) The only thing is, the first pulse will be generated after only 99 source edges, but it will be on track for every subsequent set of 100 edges.

If you have access to a 660x device, you can make this a little bit cleaner by doing the later on one counter and connecting this output to another counter doing triggered pulse generation. This wa
y you can use the second counter to actually generate the pulse so that you can have a consistent pulse width.

I hope this helps!

Russell
Applications Engineer
National Instruments
http://www.ni.com/support
0 Kudos
Message 2 of 5
(3,142 Views)
Thanks for your answer, I have tried to use CWPulse like you said, but the pulse train will stop after while. Is my setting right? please have a look in attached file.
0 Kudos
Message 3 of 5
(3,142 Views)
I think you forgot to attach the file. Are you getting any kind of error message when it stops? By the way, what is your hardware?

--Russell
0 Kudos
Message 4 of 5
(3,142 Views)
Sorry I couldn't attach the file, I don't know why.
I have put the file to http://members.shaw.ca/wdai/
could you have a look about the setting?
My hardware is PCI-MIO-16E-4
The counter source as below:
Frequency 1kHz, pulse 0->+5v, duty 50%
0 Kudos
Message 5 of 5
(3,142 Views)