Dynamic Protocol Switching
(Original Document)
General
This part describes how to change the protocol used by a CPU serial communication using the WRITE_CMD(IODDT_VAR1) command. This command can be used to switch between the following three protocols:
NOTE: IODDT_VAR1 variable must be a T_COM_MB_BMX type.
Changing Protocol: The Principle
NOTE: In order for changes to be made from one protocol to another, the processor must initially be configured to Modbus Slave mode.
You must create first an IODDT variable linked to the processor’s serial channel, then set to 1 the bit of word IODDT_VAR1.CONTROL (%MWr.m.c.24) that corresponds to the change of protocol desired:
NOTE: IODDT_VAR1.CONTROL (%MWr.m.c.24) is part of the IODDT variable IODDT_VAR1.
Afterwards, apply the WRITE_CMD instruction to the IODDT variable linked to the processor’s serial channel.
The diagram below shows the protocol changes to be made according to the bits of the IODDT_VAR1.CONTROL (%MWr.m.c.24) word set to 1:
Uses
Three protocol changes are used:
NOTE: All three cases, the default configuration remains Modbus Slave.
Cold and Warm Starts
Changes in protocol are not affected by the %S0 and %S1 bits (the bits set to 1 during a cold and warm start respectively). However, a cold or warm start of the PLC will configure the serial port to its default values or to values programmed into the application.