Applications
6.2.3 Operating Steps
Step 1: Connection
Connect PC with Modbus_TCP master with a standard network cable.
Step 2: Set Communications
Create a new project in MagicWorks PLC and add a CTH200 station, refer to chapter 2.2
Communicate with CTH200 PLC Communication Settings to establish a communication
connection between CTH200 PLC and PC.
Step 3: Program for the Modbus master (CTH200 PLC)
1) Open the Program Block in MagicWorks PLC to program for the Modbus_TCP master. You
can use either Ct_Mbus_master_tcp_single library or Modbus TCP Wizard, here are
MBTCPS_EXE instruction from Ct_Mbus_master_tcp_single library as example:
<Note> If multiple R/W operations need to be configured, it’s recommended to use the Modbus
TCP Wizard in the MagicWorks PLC. For details, refer to Magicworks PLC User Manual.
2) When finishing program, compile and download it into Modbus_TCP master device.
The following table is the definition of MBTCPS_EXE instruction
Start communication, edge triggered
number for calling MBTCPS_EXE, which cannot
be repeated, valid range 1~255
1st byte of the slave address
2nd byte of the slave address
3rd byte of the slave address
4th byte of the slave address
Monitored port of slave, if the slave is a CTH200
PLC, then the port is default as 502.
ModBus Address (default as 40001)