Instrument Control (GPIB, Serial, VISA, IVI)

cancel
Showing results for 
Search instead for 
Did you mean: 

RS 232 Communication Initialization

Solved!
Go to solution

Hello everyone, 

 

my name is Carl and I have a problem communicating with a Mass Flow Controller. Before developing a more advanced program I wanted to check the communication and how this works ( I'm new to LabView, only had Matlab and Scala so far ).

As my simple VI is not working I checked if a very simple RS232 communication tool would work (Termite 3.2). It does with the following settings: (IMG_1868)

 

Very important was the Append CR setting. Then I tried to adapt the settings to my VI. But somehow I think I got the Append CR setting wrong. It is a termination char setting and 13 is the decimal corresponding to carriage return according to different tables I've found in the internet. 

 

My VI is sending a text command and reading the answer every second. The LED shows if there is something read. 

 

As the communication is working with the termite tool it has to be a problem with my VI and the VISA settings. 

 

Thank you very much for you help!

 

Carl

Download All
0 Kudos
Message 1 of 7
(4,167 Views)

In the "Visa Configure Serial Port" detailed help, it mentions that the 'termination char' for message strings that terminate with a carriage return should have the 'termination char' set to "0xD". Change your code from 13 to 0xD and see if that works.

Andrew B.
Application Engineer
National Instruments.
http://www.ni.com/support
0 Kudos
Message 2 of 7
(4,163 Views)

Thanks for the fast answer, I tried this already, but the input for termination char only takes decimals between 0 and 255 as an input. Thats why i tried the 13 as an input for carriage return.

0 Kudos
Message 3 of 7
(4,161 Views)

Have you attempted to communicate with the device in NI MAX using the VISA Test Panels? Also, I'm assuming that you already installed NI-VISA drivers?

Andrew B.
Application Engineer
National Instruments.
http://www.ni.com/support
0 Kudos
Message 4 of 7
(4,158 Views)

Hi

Your vi is OK except for the wait 1 second. This should be done after the write and before the read.

Now it is happening in parallel to the write and the read.

You also don't need the wait at all when you have an endcharacter defined and enabled.

You should wire say 255 characters to read and the read will stop at the endcharacter or 255 characters whatever comes first.

 

LabVIEW is a real parallel language. All that is not connected by wires will execute in parallel.

So to make your program work you could also connect the error out from the write to he error in of the wait and the error out of the wait to the error in of the read bytes at port.

 

But better don't use bytes at port at all. 

 

By the way 13 decimal and 0xD is exactly the same except for writing......

greetings from the Netherlands
0 Kudos
Message 5 of 7
(4,119 Views)
Solution
Accepted by topic author Carlcarl

@Carlcarl wrote:

Very important was the Append CR setting.


You need to use a property node (ASRL End Writes) to have the CR automatically appended on the writes.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
Download All
Message 6 of 7
(4,111 Views)

I installed the VISA drivers yesterday and tested the ASRL wire and now it worked! Thanks a lot guys!

0 Kudos
Message 7 of 7
(4,099 Views)