LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

reading from serial port

In my labview life I have always used the gpib and never serial port. Now I
will have some devices that report their numbers over rs232. Is there
anything special I should know before I start in programming?
0 Kudos
Message 1 of 36
(26,978 Views)
1) Make sure you configure the serial port using the "Serial Port Init.vi" and then do the reads and writes.

2)Use the "Bytes at serial port.vi" to figure our how many bytes are there in the buffer and try not wiring the number to "Serial Read.vi" because if less bytes are there, you program will sit there and wait for the rest of bytes to come.

Remember you can also use VISA for serial comm.

A Rafiq
0 Kudos
Message 2 of 36
(26,973 Views)
In addition to the previous post I want to say that a serial_read_withtimeout VI will be a big help.
0 Kudos
Message 3 of 36
(26,973 Views)
Hallo, Adam,

Du (adamr) meintest am 20.08.01 zum Thema reading from serial port:

> Now I will have some devices that report their numbers over
> rs232. Is there anything special I should know before I start in
> programming?

Look into the examples - maybe there is one which you can import for
your purposes.

Greetings!
Helmut

Please excuse my gerlish!
0 Kudos
Message 4 of 36
(26,974 Views)
Hi
 
I need to read bytes from serial port RS232 and than try to identify each one of the bits that I'm interested in. I have already tried the examples from "Advanced Serial Write and Read.vi" but i could't obtain any result.
Please give me some advices or examples how to implement a solution for reading from a serial port rs232.
Thank you
0 Kudos
Message 5 of 36
(26,733 Views)
That's a pretty good example. When you say you don't any results, is the return string blank or does it have characters you don't understand? Did you select the correct com port and do the settings match your instrument (i.e. baud rate, parity, etc.)? Have you tried using Hyperterminal? That's the first thing I always do. If it works there, then you know your have the settings correct and are using the right type of serial cable. Are you using a null modem or straight through cable?
Message 6 of 36
(26,723 Views)
The result from the communication are characters that i don´t understand. I've selected the correct port and i think all settings match my instrument. Thank you for your advised, i´ll try Hyperterminal.
 
0 Kudos
Message 7 of 36
(26,694 Views)
For me, reading from the serial port, I usually have to convert the data in into the desired format.  The instrument I am reading from in the example is a torque controller that is manually operated.  I monitor the port continuously and when data comes in I read it.  It comes in as astring and I convert it based on the manufacturer'sspec as to what each ASCII character coming in represents.  I had to get a hex to ASCII conversion table from the internet -- just search for it -- to understand some of the numbers coming in. (If the torque read high, an extra character was sent, a hex 48, which in ASCII is a capital H)  so I had to handle that message differently.  The big thing is to understand what the instrument is putting out and hyperterminal is a way of doing that.   I am trying to include pictures.... we'll see if it works!
 
 
0 Kudos
Message 8 of 36
(26,674 Views)
 
Download All
0 Kudos
Message 9 of 36
(26,672 Views)

Message Edited by Tom Haggerty on 03-15-2007 07:21 AM

0 Kudos
Message 10 of 36
(26,673 Views)