07-03-2013 09:50 AM
Hi,
I have a vi that measures voltage for a strain gauge, as well as period of an encoder. This is done in a WHILE loop using DAQmx create->DAQmx Timing->DAQmx Start Task->(WHILE LOOP)->DAQmx Read Analog 1D DBL ->(WHILE LOOP)-> DAQmx Clear Task. Only the READ is inside the WHILE loop. Likewise, I have the counter set up to measure period in the same fashion, with READ (Counter1D DBL) etc. So, for each iteration of the WHILE loop, I read one voltage value, and one period value.
Upon further consideration, however, I realized that I do not want to read the counter value unless the voltage value is within the required range. In other words, if the voltage value is either HIGH or LOW, I want to correct it before I read the counter. Each time I read the counter value paired with a HIGH or LOW voltage value, the counter value is ignored, so, I am wasting time to do the counter part. I'd rather read a HIGH or LOW voltage value, create the command to correct the HIGH or LOW voltage, and then read the voltage again to see if it is within range. ONce it is in range, then, I want to read the counter value. Is there a way to configure it so that the counter value is read only if the voltage value is within the required range? Should I put the counter READ inside a WHILE loop that is nested within the voltage WHILE loop? Any suggestions on how to achieve that? Maybe a case structure that reads the counter only if the voltage value is in the correct range? What would be the most efficient? Each time the voltage value or the "voltage and counter" value are read, the VI outputs a command to some motors. My goal is to output as many commands per second as possible.
Thanks for your thoughts.
Dave
07-03-2013 11:22 AM - edited 07-03-2013 11:27 AM
basically yes, it can be done....
07-03-2013 11:32 AM
Hi Apok,
Thanks for the note....just one thing, though. Regarding this, "you can 'in range' your HI/LO voltage values, the output bool will be connected to your 'read' state." ...are you saying that the two READs are connected through a boolean value? Can you explain what you mean by that? I can't imagine how to connect two READs, and make the boolean in between them... very confused here.
Dave
07-03-2013 03:28 PM
from your DAQmx Read Analog, input into the 'in range' function...the output bool will connect to your case statement with whatever properties you want to manipulate...