Serial Communicating two PLCs via Modbus Table Reader

From Mikrodev Documentation
Jump to navigation Jump to search
Download Project Files

What You Need to Know Before Design

Diagram Algorithm

  • Reading of 10 Word and 10 Analog registers in RTU Slave device by RTU Master device via RS485 communication protocol.

Diagram Solition

Master Device:


Slave Device:


  • For the slave device, the Modbus RTU slave block located on the Modbus blocks tab is added.
  • Serial Port Block is added for serial communication and communication parameters are set. The slave and master devices must have the same baud rate, data bit and parity option.
  • The monitoring screen above is the RTU slave device, and below is the screenshot of RTU Master device.
  • For the master device, the Modbus RTU master block located on the Modbus blocks tab is added.
  • Since the Modbus table block reads every rising edge, the trigger is sent via the symmetric pulse generator.
  • Two modbus table blocks have been used since two different register formats like Word and Analog. Because the word registers start at 4000 and the analog registers at 6000.
  • The RTU master line tag has been added to the Mas input of Modbus table blocks.
  • The symmetric pulse generator is connected Trg input of Modbus table blocks for trigger.
  • For to be read Word and Analog values is added two separate Table Block. The output of table block is connected to the Tab input of the Modbus table block.
  • The word table field must be created twice the size of the word register to be read.
  • The analog values read from the Modbus table block constitute twice the number of registers read from the RTU Slave. An analog table size is created twice as much as the number entered in the Modbus table block. For example; There are 10 analog registers in RTU Slave. The number of registers in the modbus table read by RTU Master is 20. An analog table block with a table size of 40 is also added for data transfer.
  • Modbus table reading function as "0x03 Read Holding Register" must be selected.
  • Select "Read Offset" from the operation blocks and the table index number is entered.
  • 10 Analog and 10 Word table operation blocks have been added to receive 10 data from Modbus table blocks. This method can also be used by adding two table operation block(for analog and word) and changing the offset value by connecting the register to the "inB" input of the table transaction blocks.