LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading and charting the data (between serial port of 2 computers)

Hi Friends,

I have a problem in viewing the data, read from the serial port continously...
I connected two computers via serial cable...one computer keeps sending the data and other computer should continouly read the data and show it on the xychart(real time)...
The data bytes available to read is unknown parameter.......whenever the data is available i should read it and show it on the chart.....
here i attached my vi.. for ur suggestion to achieve my task.....

And also give some example vi's to achieve my task....

regards
raja
0 Kudos
Message 1 of 6
(3,412 Views)

Typically this application (the reader side) will work like this:

 Initialize port

Until (done reading or error){

check bytes at port

if bytes at port >0 then read bytes and add to plot (buffer or shift register can be used to store data if desired)

if error, handle error/

}

close port.

 

This pseudocode is in no way as elegant at the labview source but my LV is not avaliable right now.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 2 of 6
(3,401 Views)

Also if you have to send larger amounts of data I would consider replacing the serial communication with ethernet and use tcp/ip or data sockets.  there are examples in the example browser.  The code is almost the same. 

Writer = open port, wait for reader to be ready, send data (write) until done, close port

Reader = open port (listen) until done real data at port, close port.

 

It is that simple.  All the complex information is encapsulated into visa, datasockets or the tcp code.

 

Paul

Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 3 of 6
(3,400 Views)
HI Friend,

Sorry, i m not attached the vi file..in the last mail....
i attached it now.could u please see this file..
send some suggestion please...
I used COM1 port..and bytes to read is 5000..since i don't know the data available ...
the data bytes keeps on increasing.........

regards
raja

0 Kudos
Message 4 of 6
(3,396 Views)
I can't look at your VI but there is no reason not to know how many bytes are available. Look on your palette and see the function called VISA Bytes at Serial Port? Use it.
0 Kudos
Message 5 of 6
(3,387 Views)
You do know the bytes at the port this is a property of the com port, in traditional serial it is bytes at port vi and under visa this is a property (serial property) called bytes at port.  The port is nice enough to keep track of the bytes recieved for this exact reason (asynchronous data transfer).
 
Paul
Paul Falkenstein
Coleman Technologies Inc.
CLA, CPI, AIA-Vision
Labview 4.0- 2013, RT, Vision, FPGA
0 Kudos
Message 6 of 6
(3,385 Views)