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?
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.
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.
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?
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.
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!