The latest PLC Allen Bradley Micrologix 1400 is provided with Modbus TCP and RTU. This is a powerful feature and with this post i explain how to enable and how to use it.
To configure the Modbus communication you need to know at least the basic information about Modbus protocol.
Quick overview of Modbus protocol
Modbus protocol can be used with serial cables (Modbus RTU: RS232 or RS485) or with ethernet cable(Modbus TCP).
Modbus TCP architecture is client – server (like for websites, you with the browser are the client that ask information to the server, and the server reply). Modbus TCP devices can be both client-server and the protocol is multi-master, so every device can start the communication.
Modbus RTU architecture is master – slave (master is the client, slave is the server). The only device that can start a communication is the master and there can be only one master (usually a supervisor) and as many slave as you want. Every slave has a “Node address”, so the master can send packet to a single slave. Master does not have the Node address.
You have 4 types of registers:
- 2 are read-only (for bits and integers)
- 2 are readable and writable (for bits and integers)
Boolean block es. B3:
Read Only registers are called Contacts.
Read/Write registers are called Coils.
Numeric block es. N7:
Read Only registers are called Input Registers.
Read/Write registers are called Holding Registers.
Enabling Modbus TCP:
Important note: once you flag Modbus TCP and save the configuration, you should powerup the PLC again.
Enabling Modbus RTU Slave
To enable Modbus RTU you have to configure channel 2 as Modbus RTU Slave.
With this configuration i have:
Expanded flag: this flag permit to use 4 more N registers contigous to N15 in order to expand the holding registers area.
To enable expanded registers you need to declare N15 – N16 – N17 – N18 – N19 and to set all the registers words to 256.