03-21-2011 11:21 AM
Hi all,
rather new with LV but committed to have some good result. The attached VI (counter -10.vi) is an Up-Down counter with re-set and works fine at least with the "Software Switch" . Looking at the right side (forget about the DAQ ass't 3 so far ) if I press the Soft Switch the counter goes up or down each shot, correctly. The Soft Switch is "latched when presed" to avoid continuos counting when pressed.
Whenever I press my hardware switch on USB-6009 DAQ the DAQ OUT P0.0 toggles from 1 to 0 correctly and the comparator toggles from F to T the counter proceed in counting till the DAQ goes back to 1. In other words in the hardware transition on the DAQ port P0.0 the conter proceed free running and doesnt count one shot only (as I would like) .
Probably I should convert the DAQ output into a kind of latch signal (like the Soft Switch behaves ) but no idea how......
Any help ????
TKS
03-23-2011 08:04 AM
Hello mtradex,
It sounds like you need to have a flag indicating you have already read a value change from your DAQ device. In order to avoid your program continue to duplicate the reading, you should use a shift register that let you compare the lastest value with the new one. Please refer to the following exemple VI to if you don't know shift registers:
Basic Shift Register Examples
http://decibel.ni.com/content/docs/DOC-2158
Moreover, I keep your code more readable and added the error cluster in order to detect errors if needed.
Let me know if you need additional help or effort.
Have a nice day!