Chapter 4: PLC Communications
P-1: Modbus Slave (Server) Programming
P-1
Ladder Program
To use a CLICK PLC as a Modbus slave (server), you don't need any special ladder program.
Set up the communication port properly and you just need an End instruction in the ladder
program to put the PLC in Run mode.
However, you can add any additional ladder program to let the slave CLICK PLC control
something by itself. For instance, you may want to shut down the outputs on the slave (server)
CLICK PLC should it lose communication with the Modbus master (client).
NOTE: The Modbus master can communicate with the Modbus slave CLICK PLC without any ladder
program. However, output points on the Modbus slave CLICK PLC cannot be turned on if the PLC is not in
the Run mode. Because of this, we recommend having at least one End instruction and to put the PLC in
Run mode.
Lost Communication Situation
You may want to detect if there is something happening at the Modbus master side that
stops communication with the Modbus slaves. Or, the communication cable might have
been disconnected. In this situation, you may want the Modbus slaves to take an action.
For instance, you may want to shut down the outputs on the slave CLICK PLC when the
communication with the Modbus master is lost. We offer an easy method to accomplish this.
The CLICK keeps counting how long it has been since each com port received a message from
the Modbus master, and enters the time duration in the following system data registers.
Each register is reset to zero automatically when the com port receives a message from the
Modbus master. Then its value increments by 1 per second until the com port receives another
message from the Modbus master. If one of these registers has 60 as its value, it means the com
port has not received any message from the Modbus master for 60 seconds. You can use this
info to shut down the outputs on the slave CLICK PLC. Here is an example program.
4–26
CLICK PLC Hardware User Manual, 6th Edition, Rev. F – C0-USER-M
System Data Registers
System Data Register
SD41
SD51
SD61
This contact is on when com port 1
has not received any message from
the Modbus master for 60 seconds.
Nickname
_Port1_No_Comm_Time
_Port2_No_Comm_Time
_Port3_No_Comm_Time
Reset the outputs Y001 to Y006.
Range
0 - 32767 (sec)
0 - 32767 (sec)
0 - 32767 (sec)
Need help?
Do you have a question about the C0-USER-M and is the answer not in the manual?