LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

rs232 ASCII data reading

I have a thermometer that connects to computer using RS232 protocol. I tried the simplest Read and Write vi to get data from the device. But it returns something in a form of ASCII symbols, which are not displayed correctly. I have some protocol from the manufacturer with commands, but cannot figure out how to form a command to get temperature data. Could someone suggest anything about my issue?

 

ps

Below I attached that protocol

 

0 Kudos
Message 1 of 11
(5,618 Views)

@alex_mikh wrote:

I have a thermometer that connects to computer using RS232 protocol. I tried the simplest Read and Write vi to get data from the device. But it returns something in a form of ASCII symbols, which are not displayed correctly. I have some protocol from the manufacturer with commands, but cannot figure out how to form a command to get temperature data. Could someone suggest anything about my issue?

 

ps

Below I attached that protocol

 



Probably your serial port isn't set up correctly.  Can you communicate with the instrument through hyperterminal?

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 11
(5,609 Views)

hello,billko!

I didn't try. My knowledge about LabView are weak. Could you describe how to communicate with serial device by hyperterminal?

 

regards, Alex

0 Kudos
Message 3 of 11
(5,604 Views)

No, the format is not straight ASCII. You will need to convert the returned string to bytes with the String to Byte Array function. Each byte will need to be interpreted according to the document. Some bytes will need to be combined and then typecast. For example, the time interval is returned as two bytes with the first byte representing minutes and the second byte is seconds. Some of the other data is more complex.

0 Kudos
Message 4 of 11
(5,598 Views)

@alex_mikh wrote:

hello,@billko

I didn't try. My knowledge about LabView are weak. Could you describe how to communicate with serial device by hyperterminal?

 

regards, Alex


Hyperterminal is a standalone serial communications application.  If you can communicate with your instrument through Hyperterminal, the chances of communicating with your instrument in LabVIEW go way up...

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 5 of 11
(5,593 Views)

i was able to check my serial connections with some vi (found it somewhere here). So, the device definitely can send some information (see below), but I have no idea how to understand the answer. Maybe I should use particular command to get temperature data to thermometer? I have protocol that came with it (attached below), but can figure out which command to use.

Download All
0 Kudos
Message 6 of 11
(5,586 Views)
As I said, you will have process the data byte by byte. I'm not that impressed by that document but it is similar in concept as other omega instruments that also send/receive hex. It can be done if you spend some time though it can be daunting for a beginner. What can help is if you have a sniffer such as portmon that will show the hex while you run the vendor's program that shows data as ASCII.
Message 7 of 11
(5,578 Views)

Nice idea!

Don't know exactly how to capture ASCII / HEX commands which the device's own software used to communicate with it though( will try. Thanks!!

0 Kudos
Message 8 of 11
(5,575 Views)

I tried to use portmon as was recommended and captured some data. But they are again in some weird form: it is neither HEX code nor numerical symbols. I'm confused(

0 Kudos
Message 9 of 11
(5,550 Views)

The log shows that the instrument periodically sending some data though the number of bytes is not consistent. You see it will the lines that say "READ VCP0" which I think is virtual com port 0. Some are 22 bytes long and some are shorter. My recollection of portmon was that you could see the entire message. Perhaps when saving to the log file is different. The vendor's program does not appear to write anything. Just checks to see if any data in the buffer.

0 Kudos
Message 10 of 11
(5,537 Views)