LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Can I monitor the VISA read as the data comes in?

Hi.
I'm reading the serial data using VISA read.
But I can only see the data when it is finished
reading. This can take up to 5 minutes or more.
Is there a way to see the data as it comes in?
Or atleast see the first 16 bytes of the data?

Thanks,
Van
0 Kudos
Message 1 of 10
(3,850 Views)
You can use two VISA reads. Set the first one for 16 bytes and the second one for the remainder of the data. Another way is to put the VISA Read in a loop. Divide the expected byte count by some number and execute the loop a fixed number of times or until there is no more data to be read. Take the output and wire it to an concantanate string function that's wired to a shift register.
Message 2 of 10
(3,849 Views)
Thank you Dennis.
I will try that.

Van
0 Kudos
Message 3 of 10
(3,849 Views)
Hi Dennis,

I have the Read.vi read one byte at a time.
Now I need to concatenate all these characters
into one string. I'm having problem following
your suggestion. Could you verify this?

Thank you,
Van
0 Kudos
Message 4 of 10
(3,849 Views)
You should be using a shift register to concantenate the bytes read. Attached is a simple read inside a while loop with the shift register.
0 Kudos
Message 5 of 10
(3,849 Views)
Thank you Dennis, again.
I'll try this.

Much Appreciated,
Van
0 Kudos
Message 6 of 10
(3,849 Views)
I am having a simular problem.  I am reading the data from the commands that I am writing but the read cannot seem to keep up with the write.  What I mean by this is that I will write a move command followed by a tell position command.  I have these in the same write command box.  I will get some of the position data but it seem to lag behind the write commands as it does not display the correct positon.  I am moving a microscope stage and it is moving correctly and at the end I can use a different visa write and read to check it's positon.  I will include the vi.  Would concentrating the strings like in the pic help?  I was also thinking of puting the two commands in a stacked sequence but I do not know if that will work with the multiple writes and reads I am doing in the for loop.  Thanks for any help.
0 Kudos
Message 7 of 10
(3,713 Views)
You have some dataflow problems and I think you have some timing issues. For one, you are using the Wait (ms) and because that function does not have an error in/error out connection, you don't know exactly when the wait is happening. Alos, immediately after you do a write, you check to see how many bytes are available and read that number. It's certainly possible that you are missing some information because the instrument hasn't yet transmitted the information yet. You might want to use a wait function after the write, then check number of bytes, and then do the read. Use the Time Delay function which does have error in/error out so that you can enforce dataflow with resorting to sequence structures. Sequence structures are not something you should use a lot of. You can also put a loop after the write and do a Bytes at Serial Port and exit the loop when the byte count is equal or greater to a certain number.
Message 8 of 10
(3,708 Views)
Thanks for the help I will post if it works.Smiley Happy
0 Kudos
Message 9 of 10
(3,700 Views)
That did the job very well thanks very much.
0 Kudos
Message 10 of 10
(3,695 Views)