LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Need help with sending commands through serial port

I have a pump with control through RS232 port. I would like to have a control on it through LabView.
I just do not know where to start. In instructions it says that I can use terminal emulation program sauch as IMS Lynx Terminal, Windows Terminal or ProComm to send commands to it. I have tried IMS Lynx Terminal and it worked.
Then I have tried samples shipped with LabView for serial port simple Basic Serial Write and Read.vi and other VIs but when I send commands through them nothing happened.
What do I do wrong? Do I have to configure serial port in Measurement and Automation explorer somehow? May be I have to add something before or after commands I send.
The commands looks just like that
SLEW=20
VM=20
SSTP
etc.
Can I try to control pump from Measurement and Automation explorer first. I have tried it but result was the same: no reactions on typed in commands.
Thanks. Sergey.
 
 
0 Kudos
Message 1 of 6
(3,275 Views)
When you first opened up the example, did you notice the '\r\n' characters at the end of the string to write? Because the string control is set for '\' Codes Display, the characters are Carriage Return and Line Feed. Hyperterminal automatically appends these to whatever you type and you probably need them in your LabvIEW program. The Advanced SErial Write and Read does it a little differently by setting the VISA property node to enable a term character with every write.
0 Kudos
Message 2 of 6
(3,260 Views)
Thanks Dennis,
your comments are very helpfull as usually.
I did the trick. Hope I can continue from here by myself.
Sergey.
0 Kudos
Message 3 of 6
(3,253 Views)
I have tried to modify Basic Serial write and read VI and did not succeed so far.
If I am replacing string control with constant and in this constant I am writing the same command as it was in a string control then my pump just ignores it. I can see this command in write box that means that pump received it and send it back but it did no react on it.
I have added VISA write in FALSE case with constant as well. It did not react on it when I am placing switch in off position but reacts on it when I am returning it back to ON position. It reacts like this: with string control in place I am turning off switch and turning it on again pump stops and almost immediately starts to pump again. When it placed in off position I can see in the read window the constant command SSTP\r\n when I turn it into On position I can see in the read window SLEW=20  without \r\n.
How to change it so that it reacts as I would like it to be.
Actually, I need for the start, control over pump that allows to change its speed(without typing command) just changing number. Something like numeric control on front panel and ability to stop it by using switch.
You can see that stopping is is almost in place but I still have no idea how to implement numeric control in sending command to the pump.
I would welcome any comments and ideas.
Thanks. Sergey.
0 Kudos
Message 4 of 6
(3,235 Views)
See my comment above about 'Because the string control is set for '\' Codes Display' and do the same thing for the string constant. Without this setting, you are just sending the characters "\", "r","\", and "n" and that's not the same thing.
0 Kudos
Message 5 of 6
(3,217 Views)
Thanks Dennis again.
Sorry for such stupid questions but I do a different things for a living than LabView programming.
It is just a necessity to program sometimes.
I understood your comment and changed Constant properties about this \ thing.
Sergey.
0 Kudos
Message 6 of 6
(3,208 Views)