Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

Communication through MAX with serial device

Solved!
Go to solution

I am using a RS 232 to USB converter to communicate with a gas analyzer. I want to communicate using C-link protocol to communcate with the analyzer but I'm having trouble doing that through Labview and MAX. In the manual for the machine it says that the commands to the device have to begin with the ASCII character code for 128 plus its instrument id, which in my case is 43, meaning the command must start with ASCII character code 171. Each statement then has to end with a carriage return. I've tried multiple different ways to send these commands but in MAX I get an error about timeout for the VISA Serial Communicater and in Labview I get an error on the property node(I used the Basic Serial Write Read vi provided).

Can anyone help me on? I'm just not really sure how to send these commands properly to the analyzers.

0 Kudos
Message 1 of 6
(4,688 Views)

You can use either technique below to send decimal 171.

 

Write Decimal code.PNG

 

There are thousands and thousands of posts related to RS232 communication. Searching the boards with the proper terms is almost certain to find an answer.

 

Also, I don't know how you can get an error with the property node. Show what you have done.

0 Kudos
Message 2 of 6
(4,685 Views)

Dennis,

I tried the method you recommended and the modified Basic Serial Write and Read to get the following code. Also I wanted to note that I don't need to just pass 171, I need to pass that followed by a command and then a carriage return. The VI I have now runs without an error but I get no response. Through other posts I've figured out that this is not necessarily a good thing. Any help on getting this to work?

 

As far as the property node is concerned I figured out why I was getting that error message.

0 Kudos
Message 3 of 6
(4,653 Views)
Oops. This is the code
0 Kudos
Message 4 of 6
(4,652 Views)
Solution
Accepted by topic author CorrAtm
You are sending the characters 'C' and 'R'. That is not at all the same as the CR control code. You could have used the typecast to send hex 0D, you could use the CR constant on the String palette, you could set the string constant for hex display and send 0D, you could use the string constant set for '\' Codes Display and send \r.
Message 5 of 6
(4,649 Views)

Figured it out. It was the carriage return.

 

Thanks for the help!

0 Kudos
Message 6 of 6
(4,645 Views)