LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

what am I missing: RS-232 Hyperterm communicates but basic serial write / read doesn't

I have a pump that communicates by RS-232.  I can use windows hyperterminal and communicate with the pump without any problems.  I want to move the pump over to a LabView VI and to get started I tried using the basic serial write and read VI from the examples in LabView 8.5 but was not able to communicate with the pump.  The hyperterminal settings are a standard bit per second: 9600, data bits: 8, Parity: None, stop bits 1, flow control: None.  Then the manual has the hyperterminal set to select "terminal keys", Emulation set to Autodetect and 500 for Backscroll buffer lines, send line ends with line feed, echo typed characters locally and enter a line delay of 0 and Wrap lines that exceed terminal width are all selected.

 

Why does the hyperterminal work but not the RS-232 basic serial write example?  The pump supports OEM communications protocol, Data terminal protocol and CAN.  Since I have been using hyperterminal with the DT protocol I thought this would be the easiest to move to LabView?  

 

Thanks

 

 

Danny
0 Kudos
Message 1 of 4
(2,643 Views)
With the example, did you include the \r\n that is part of the default string to send? That is the way a CR and LF are sent and if you just deleted them, then the command is not terminated and will not be recognized. This is a very common mistake and if you had done a forum search for RS-232 or serial, you would have seen that a very large number of posts mention this.
0 Kudos
Message 2 of 4
(2,634 Views)

Hi Danny,

 

Dennis is correct, it sounds like an issue with termination characters.  I just wanted to add that in the example, the string control is set to " '\' Codes Display ."  This will enable you to write the non-printable characters such as \n, \r, \t, etc.  (line feed, carrage return, tab respectively.)  This is already set in the example, but if you begin to write your own VI you will need to set your string control to " '\' Codes Display ." 

Caleb W

National Instruments

0 Kudos
Message 3 of 4
(2,604 Views)

Dennis and Caleb, thanks for the help.  The problem was that I didn't have the \r because I didn't think I needed it as the pump commands are required to end with an R.  So to communicate with the pump all I had to do was change the end of the string from ...R\n to ..R\r\n.

 

Thanks again for the help.

 

Danny

 

 

Danny
0 Kudos
Message 4 of 4
(2,586 Views)