LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQ reading incorrect when using a loop

Solved!
Go to solution

HI, 

I have wriiten a simple VI to output (00, 01, 10 and 11) to a circuit connected with 4 resistors. Based on what value the ciruit recieves, it passes current through one particular resistor. This is again input to Labview and plotted. 

The problem is when i send one particular value (i.e one of 00, 10, 01 and 11) and get it back, it is correct. But when I send and recieve them consectively connected through loop counter, they are incorrect (not synchronized with loop number). 

I have made sure that circuit is working fine. it has something to do with loop synnchronization, resetting, clearing value etc may be.

Please Guide...

 

Download All
0 Kudos
Message 1 of 6
(2,910 Views)
Solution
Accepted by topic author MAnees

Change your DAQ assistant that reads to be 1 sample on demand.

 

Right now it is set for continuous samples.  And 10 samples at 10 Hz.  So it runs and starts.  Next iteration, you send a new digital out, but have waited 4 seconds.  When you read again, you are getting the next 10 samples that are put in the DAQ buffer, but in that time 40 samples have actually entered the DAQ buffer.  In time your DAQ buffer will eventually fill up and throw an error.  In the meanwhile, you will continually be reading data that is keeps getting more stale by the iteration.

0 Kudos
Message 2 of 6
(2,902 Views)

Hi MAnees,

 

did you try to debug your VI? Did you check the data you send to your DAQAssistent?

 

You don't need a sequence once you use proper DATAFLOW - see attachment…

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 3 of 6
(2,900 Views)

Hi GerdW,

i have tried to debug the VI and use probs etc. In the VI you attached as well, when i attach one of the four constants (0,1,2,3) with the output to DAW it works fine.(see the VI attached) When i connect the loop number values are again off. Can u suggest what could be the reason?

0 Kudos
Message 4 of 6
(2,890 Views)

Hi MAnees,

 

did you read Ravens answer - and did you follow his suggestion?

 

Other way: remove the wait in the FOR loop!

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 5 of 6
(2,883 Views)

Thanks alott...yes this was the problem and I had no idea about it. I needed 10 samples each time so i chose N samples. 
Thanks again. Much appreciated!

 

0 Kudos
Message 6 of 6
(2,882 Views)