LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Serial port communication problems

Solved!
Go to solution

Hello.  I am trying to control a MKS Instruments 651C Pressure Controller via RS-232.  Right now, I am just trying to establish basic communication with the device over the serial port.  I can connect to the device with windows hyperterminal using the following settings:

 

Bits per second: 9600

Data bits: 8

Parity: None

Stop bits: 1

Flow control: None

 

Once I connect, I go to File-->Properties, Settings tab,and click on ASCII Settings button.  I must check the following boxes (not checked by default) for any communication to occur:

 

Send line ends with line feeds

Echo typed characters locally

Append line feeds to incoming line ends

Force incoming data to 7-bit ASCII

 

Once I have all that set, I can communicate with my device via hyperterminal.  What I would like to do now is to use LabVIEW to control the device, so I need to be able to send/receive data over the RS-232 connection via LabVIEW.  I have been using the Basic Serial Write and Read vi, but I am not getting any response from my device.  Looking at the block diagram for the basic read/write, I saw that  Enable Termination Char was hardwired to false, so I changed it to a control and set it to true.  I also changed Termination Char to a control and set it to 0xD for CR.  I still cannot get a response from the device.

 

I'm guessing that I am still not setting everything for the serial port setup correctly.  Can anyone give me some suggestions on what else to modify to match my hyperterminal settings?  Thanks!

0 Kudos
Message 1 of 16
(7,282 Views)
A line feed is 0xA not 0xD. I do not think you can use a CR you have to use a line feed. That would be the first thing I see.
Tim
GHSP
0 Kudos
Message 2 of 16
(7,272 Views)
Please attach your code.  I would be guessing at this point without seeing the block diagram.
0 Kudos
Message 3 of 16
(7,270 Views)
I have tried both 0xD and 0xA and neither seems to work.  According to the manual for my device, all messages must us a carriage reurn-line feed as the end-of-line delimiter, which is why I used 0xD.
0 Kudos
Message 4 of 16
(7,267 Views)
Here is the code.  It is literally the Basic Serial Write and Read vi with the two changes I mentioned above.
0 Kudos
Message 5 of 16
(7,265 Views)
I have an easy question is it set up to the correct com port?
Tim
GHSP
0 Kudos
Message 6 of 16
(7,264 Views)
I believe it is.  I can communicate via COM1 through hyperterminal.  I am using NI-VISA, so I select COM1 in my vi as well.  I also have a separate USB serial port that is COM4.  When I switch the cabling and connect to COM4 through hyperterminal it works.  Selecting COM4 in my vi does not.
0 Kudos
Message 7 of 16
(7,257 Views)
Have you tried running NI-Spy to see what is actually happening on the serial port? This may help you narrow down what is happening. I also wonder if you are having an issue since you are using 8-bit ASCII when you open the port but in hyperterminal you are telling it to use 7-bit ASCII to read the data.


Mark Yedinak
Certified LabVIEW Architect
LabVIEW Champion

"Does anyone know where the love of God goes when the waves turn the minutes to hours?"
Wreck of the Edmund Fitzgerald - Gordon Lightfoot
0 Kudos
Message 8 of 16
(7,249 Views)
I found this LLB from MKS. I realize that it is not the same model but maybe you can see what is going on with what they did.
Tim
GHSP
Message 9 of 16
(7,244 Views)

Mark,

 

I realize this 7-bit ASCII thing may be the problem, but that is the only way hyperterminal will communicate with the device.  How can I get LabVIEW to do this?

0 Kudos
Message 10 of 16
(7,239 Views)