I have an USB-6000 and it has 4 digital channels. I would like to use one or more analog channels as digitals because 4 is not enough for me.
I know that if I compare the input voltage to a value, when the data is equal or more bigger than the voltage that the target reads (5V for example), it means that the digital input has changed.
I have the following VI to mantain "End of cycle" as true when this input give me the signal.
Do you know what am I doing bad?
I attach the VI
Thanks in advance.
Odds are you're working with TTL logic that's less than 5V. Generally speaking, you don't look for the maximum voltage in a TTL signal.
Also, you've got some logical flaws in place. Being higher than that value does not tell you the value changed. It just tells you that it's currently high. If it was high prior, it's still high. Reading a small value might designate a change.
Your code is setup to only do anything of notice if it reads a high once. Every other time, it'll just ignore things. You're reading multiple data points. If the first value is low and a later value is high, you have the potential to skip the stop logic entirely.
What exactly are you trying to do here?
Two suggestions. First, do a Web search for "Learn 10 Functions in NI-DAQmx ...", read it, and never use the Dreaded DAQ Assistant again, nor its Evil Twin, the Dynamic Data Wire (use 3-5 simple DAQmx Functions + Tasks created in MAX or LabVIEW Project Explorer, and Waveforms or Arrays of Dbls). Second, do a Web search for TTL (Transistor-Transistor Logic) and learn how to distinguish Digital 0 from Digital 1.
So how are you currently using the four digital channels? Can you show us that code? You can always convert an analog value to a boolean by doing a comparison (e.g. >2.5V) similar to what you tried, there's nothing magic about that. To see if the value has changed, you would use a feedback node and compare with the previous, so don't stop the loop whenever something happens. How were you planning to incorporate that code fragment into the rest of the code?
However, from the convoluted and senseless code you show in the pictures, I think you should do a few more tutorials. In addition to the IO, you need to learn the basics of graphical programming and the magic of dataflow.