LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial VISA Read: read buffer string to table of recorded data values? (First Post)

Hello all, this is my first post on this forum!

 

I am an undergraduate research assistant working on writing a program for lab research equipment. This is my second week using LabVIEW, and my first time ever working with Serial RS232. I have programmed temperature/pressure sensors with the NI DAQ board, but this VISA programming is entirely different and I believe I could use help with a step in the right direction.

 

My goal is to take realtime data from a seismograph device across RS232 and have it read out on a graph showing the waveform. The hardware I am reading from continuously outputs integer values one after another for the data. I am currently able to read from the device and show the individual value on a string indicator coming from the read buffer of the VISA Read Function. Running the program continuously displays values on the string indicator in real time as the data changes from the device.

 

I would like to take the string data from the VISA Read Function and 1) list the data values sequentially, as they are read, onto a table containing all other read values, and 2) take the data values from the table and put them on a graph that will display the seismic activity in real time as the data values are read from the device.

 

Attached is a screen shot of the program I have written. It is extremely simple, clearing the buffer and then waiting 100ms before reading each value.

 

Thank you for your assistance!

 

celeritas

0 Kudos
Message 1 of 19
(10,744 Views)

Never use the run continuous button. That is just a debug tool. You need a while loop around the read. In order to write to a table, you would need a shift register. The Express table might be different but I don't use Express VIs often. To plot, you would convert the string to a numeric and wire it to a chart.

 

p.s. Using the VISA Configure Serial Port with termination character enabled along with the VISA Bytes at Serial Port is a bad combination. If your instrument sends data with a termination character, you just need a constant wired to the byte count of the VISA Read. You would also eliminate the wait function.

0 Kudos
Message 2 of 19
(10,730 Views)
Hi! I am doing data acquisition using xbee receiver.I am able to receive data using LabVIEW visa read.Now my task is to plot this data on graph having time on x-axis and received values on y-axis.Please tell how can I plot the graph by taking values from read buffer of visa read?
I am sending data as (0,1,2) and received in lab view read buffer indicator as 012012012....
0 Kudos
Message 3 of 19
(9,002 Views)
If you are actually sending the values with a comma between the values and terminating the string with a line feed, you can simply use the Spreadsheet String to Array to get the separate values. You should be using a chart and not a graph.
0 Kudos
Message 4 of 19
(8,987 Views)
Can you explain line feed?
0 Kudos
Message 5 of 19
(8,976 Views)

@ZohaibRamzane wrote:
Can you explain line feed?

LIne feed is a specific character in the ASCII chart.  In the terms of a byte value, a LF is 10 in decimal, 0xA in Hexidecimal.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 6 of 19
(8,969 Views)

I am getting problems in getting the right Graph chart....

The array that i am sending is like this

unsigned char abc[7] = {' , ', '2 ', ' , ' ,' 4 '};

The vi and the data i am getting is like this.....in figures

Please tell me where i am wrong...

Download All
0 Kudos
Message 7 of 19
(8,944 Views)
Your code only runs once unless you are clicking the ruin continuous button and you should NOT use that. You have the termination character enabled but are using the Bytes at Serial Port. Your transmitter should be configured to append a termination character (i.e. LF) and you just specify an arbitrarily high byte count to read. You should be converting to a 1D array when you fix the transmitter. The read will automatically terminate with it's detection. Place just the read inside a while loop if the transmitter continuously writes data. What is the purpose of the IDN? command? That is a standard for GPIB instruments.
0 Kudos
Message 8 of 19
(8,929 Views)

Hi! I have changed my vi.Now i am continuously reading data from the port. I amsending an array like

unsigned char abc[6] = {'0',',','8',',','1',','};

but Instaed of getting constant 0 value in first graph chart ,i am getting varying value 0->8->1.Same problem is with other graph chart.

How can i tackle this prroblem? Please modify the vi or tell me the right way to do it.

Download All
0 Kudos
Message 9 of 19
(8,889 Views)
You've been told to modify the transmitter so that you append a termination character after the 4 values. You have not done that. Do you actually have control of that software? As it is, you will have a problem synchronizing with your random writes. Not a problem with your LabVIEW code.
0 Kudos
Message 10 of 19
(8,855 Views)