LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

how to read one DAQ instead of two

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

0 Kudos
Message 1 of 4
(2,096 Views)

basically yes, it can be done....

 

  • you can 'in range' your HI/LO voltage values, the output bool will be connected to your 'read' state.
  • 'read' state can be indicators being visible with the values, writing values to a file, leds lighting.....and the list goes on with whatever properties you want to change on the front panel.
0 Kudos
Message 2 of 4
(2,082 Views)

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

0 Kudos
Message 3 of 4
(2,078 Views)

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...  Smiley Wink

0 Kudos
Message 4 of 4
(2,064 Views)