Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

buffering a data set

I am reading in a stream of data over a serial port at a rate of about 8-9Hz. As I read the data in, it is parsed and displayed on a front panel. this is done by way of a subvi that parses the string and seperates out the data. I am having problems with displaying though. I need help figuring out how to read in my data, but not sending my incoming string to my subvi until I have a complete data set. at the end of the incoming string, I am looking for x0d, but just can't figure out how to buffer my incoming data until I have a complete set. any help/examples would be greatly appreciated.
0 Kudos
Message 1 of 4
(3,259 Views)
JMorgan,

use a while loop to continuously receive and check your data. In a loop one can create a shift register SR (right-click on the loops border). Initialise this SR from its left ide with an empty string. Inside the loop, read al availabel bytes at serial port and append it to what is in the SR. Match the result with 0x0d and, if found, send the substring before 0x0d to your subVI and the remainder to the right side of the SR. If nothing was found, send the substring before match to the right SR.
You should as well have a wait 100ms inside the loop.
Stop the loop when you're done.


HTH and Greetings from Germany!
--
Uwe
Message 2 of 4
(3,254 Views)
I'm having a little trouble figuring this out. I'm fairly new to labview and am still trying to figure out a lot of it. Do you have any sample code that could show me how to match the results to 0x0d and append to the shift register?
0 Kudos
Message 3 of 4
(3,247 Views)
"0x0d" is for Carriage Return (\r) in ASCII code. You can simply input the value of 13(decimal for 0d) into the "termination char" input of the VISA Configure Serial Port vi. VISA Read will terminate the reading when a carriage return is received.

You can use the "Advanced Serial Write" example as reference.
Message 4 of 4
(3,239 Views)