12-02-2015 08:28 AM
Hi Everybody,
I have a while loop which has both a DAQ reading and a VISA serial reading.
The DAQ readings are slowing down the while loop for serial com, and therefore the iterative nature of the serial measurements of constantly checking byte by byte (for the full line of code: 22 bytes) is not working. (it will check at 8 bytes, 24, .. etc because more bytes are being collected in buffer before it can run through loop again.)
Is there a way to synchronize these two data acquision devices?
The speed of the DAQ is fast enough, so if there is a way to hold the serial bytes in a queue and only take the first 22 bytes for every while loop iteration?
Thank you for your help. I can not attach VI, but I can provide a reference picture.
Solved! Go to Solution.
12-02-2015 09:09 AM
I recommend having the Serial Read and the DAQ loops seperate. If you are just logging the latest value, the local variable is fine for sending the serial reading to the other loop for logging.
12-02-2015 09:23 AM
Okay so the two while loops should be able ro un at the same time (local variables do not create data dependency right?), and the local variable will update each iteration?
Does it matter if one of the while loops (DAQ) is a producer in a consumer/producer relationship?
Thank you crossrulz!
12-02-2015 09:55 AM
smat123 wrote:
Does it matter if one of the while loops (DAQ) is a producer in a consumer/producer relationship?
I'm not recommending a Producer/Consumer. I'm just talking about two loops who just share data via a local variable. A Producer/Consumer is more about streaming of data/commands.
But I would recommend just moving your serial port reading into another loop and leave the DAQ and logging in your other loop.