04-24-2015 07:02 AM - edited 04-24-2015 07:02 AM
Yeah, you made things way too difficult.
Have your read loop run as fast as it wants. The rate of the data coming in from the VISA Read will limit the loop rate.
Do not have a timeout on the Dequeue. Let it just get the data whenever it comes in.
Let the consumer loop destroy the queue. Your producer loop should send the stop command when it completes. This will ensure you process all of the data.
So your code should look something like this...
Note: The Destroy Queue is in the STOP case in the producer loop.
04-24-2015 12:39 PM
Thank you for your response. I did go back to my original vi and I had changed the termination character. What I did was add a check for 32 bytes before the case structure. I have attached the actual read string from the front panel, the vi and the write to measurement file. I do not believe my output data is correct though.
04-24-2015 12:58 PM
@gprall001 wrote:
Thank you for your response. I did go back to my original vi and I had changed the termination character. What I did was add a check for 32 bytes before the case structure. I have attached the actual read string from the front panel, the vi and the write to measurement file. I do not believe my output data is correct though.
Why not? What about it do you think is wrong? The screenshot looks okay. It looks like complete packets of data to operate on.
But you still didn't set your VI up properly. DON"T USE Bytes at Port. Get rid of it. Get rid of the case structure. Just set your VISA Read to read 16 bytes. (Or more is okay as well). Right now you are polling your data waiting to see if you have 32 bytes or more, trying to read that and then getting everything up to the termination character. This actually means you are getting somewhat stale data because you are waiting for the 2nd packet of 16 bytes to come in (to get 32) before you try to read the first 16 bytes.
Also, you have a shift register on the error wire. Don't do that either.
See the attached VI for modifications.