Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

rs232 decoding of recieved data

I have been unable to work out from the supplied examples how to decode received data from the RS232 connection, the data is being sent from and pic micro-controller (16F877)? How can I do this? Probably over looked something very simple, but this is the first time I have used this software?
0 Kudos
Message 1 of 5
(4,427 Views)
Are you using LabVIEW? If so, you can use NI-VISA to open the COM port and perform a read. The data is read as a string which you can then manipulate.
Message 2 of 5
(4,427 Views)
Thanks for your reply, but I am using LabWindows CVI, sorry should have stated it in the question.
0 Kudos
Message 3 of 5
(4,427 Views)
Hi,

Serial communication is based on transmiting byte-sized (max.) frames, which is why most serial port APIs use strings data types to represent the data, both sent and received.

I assume you are using the RS232 CVI functions (not VISA). Then, you would use ComRd to read from the serial port. The returned data is stored in a char array (string). The serial driver simply puts the received bytes in this array. The actual format of the data depends on what your instrument is sending. It could be sending ASCII data, interger values (8-bit, 16-bit or 32-bit), little or big endian, etc. The number of data formats is infinite. You need to determine exactly what the device is sending and parse the returned array according to that.

Rememb
er that the serial API just provides the communication channel. It doesn't play any role on what is being sent.

Hope this helps.
DiegoF
National Instruments.
Message 4 of 5
(4,427 Views)
Thanks, it turned out to be a silly problem with the MAX232.
0 Kudos
Message 5 of 5
(4,427 Views)