LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

multi-channel relay control through serial port

It's my first experience for controlling the external devices through the serial port (RS232).
I need to control a 8ch relay block through RS232 port, just for switching
each relay (for example, make all relays to close when the true case is met).
 
Could you advise how to write a vi for this? or some example.vi exist?
Thank you.
0 Kudos
Message 1 of 6
(3,910 Views)
Does this relay block have a set of commands to open/close individual relays? If it's programable, then the vendor has to supply those commands and you should test them first with Hyperterminal and then you can write a program using the VISA Write function to send them to the serial port. LabVIEW ships with a couple of examples for serial communication that you can use as a template. Unless you provide the make and model number of the relay board, it would be impossible to provide an example since every vendor's commands are different.
0 Kudos
Message 2 of 6
(3,908 Views)

I found one ADR2205 from Ontrak Control and here are commands;

RELAY OUTPUT COMMAND SUMMARY
SKn Sets ( closes contact ) Relay specified by n ( n = 0 to 7 )
RKn Resets ( opens contact ) Relay specified by n ( n = 0 to 7 )
SPKxxxxxxxx Output binary data to Relay PORT K. ( x=1 or 0 )
MKddd Outputs decimal data (ddd) to Relay PORT K. (ddd= 0 to 255 )
RPK Returns status of all Relays in PORT K in binary format.
RPKn Returns status of Relay specified by n in PORT K ( n = 0 to 7 )
PK Returns status of Relay PORT K in decimal format.

What will be the vi ?
0 Kudos
Message 3 of 6
(3,899 Views)
Okay, here's a simple example for opening and closing a relay. You will need to know the actual termination character (if one is required) that is listed in the vendor's documentation. And, as I said, you should first try Hyperterminal to verify the serial port settings and the cable.
0 Kudos
Message 4 of 6
(3,895 Views)
Thank you.
What is the Hyperterminal and how to use it?
0 Kudos
Message 5 of 6
(3,888 Views)
Hyperterminal is a program that has shipped with every version of windows since at least 3.0. It's a terminal emulator and can be found at Start>Programs>Accessories>Communication. Start it up, give the session some name, select the com port, and then the settings. Type your commands in the window and see what happens. If you enter the command to close a relay and it doesn't close, then your port settings are incorrect or you are using the wrong type of serial cable.
0 Kudos
Message 6 of 6
(3,878 Views)