Homework
Homework
College of Engineering
ECE Department
Problem: 1
For each of the following request and response messages, write it in the form of Modbus RTU,
Modbus ASCII, and Modbus TCP and the number of total bytes in each message.
For Modbus ASCII, you can assume any valid value (one byte/two ASCII Character) for
LRC.
For Modbus RTU, you have to calculate the CRC value using CRC-calculator which can
be downloaded from the link: http://www.simplymodbus.ca/crc.xls
For Modbus TCP, you can assume any valid value (2 bytes) of transaction ID for request
and response messages.
For example request and response messages, you can refer
http://www.simplymodbus.ca/FAQ.htm
1. Request: Read 20 inputs starting at discrete input number 12001 from a slave device with
address 90.
Response: The discrete input number 12002, 12009 and 12015 are set (1) and all others are clear
(0).
Modbus
ASCII 3A 3541 3032 3037 4430 17 bytes 3A 3541 3032 3033 3032 3431 17 bytes
3030 3134 4339 0D 0A 3030 3641 0D 0A
Modbus
TCP 00 12 00 00 00 06 5A 02 07 12 bytes 00 12 00 00 00 06 5A 02 03 02 12 bytes
D0 00 14 41 00
Sultan Qaboos University
College of Engineering
ECE Department
2. Request: Read 4 input registers starting at register number 31040 from a slave device with
address 42. Response returns register 31040 value 10000, and register 30202 value 50000:
Response: Return the contents of register number 31040 to 31043 and the contents of register
31040 to 31043 are B170, A27D, 11CC, A213 respectively.
Problem: 2
Interpret the following request message by specifying precisely what is requested from which
slave devices?
Modbus ASCII Request: 3A 30 31 30 36 30 30 36 34 33 41 39 38 43 33 0D 0A
ASCII Hex 3A 30 31 30 36 30 30 36 34 33 41 39 38 43 33 0D 0A
Hexadecimal : 0 1 0 6 0 0 6 4 3 A 9 8 C 3
Format Start Slave Function Register address Data address LRC End
address code (100) (15000)
(1)
What will be corresponding Modbus ASCII response of above request message if request is successfully
fulfilled by slave device?
Hexadecimal : 0 1 0 6 0 0 6 4 3 A 9 8 C 3
Sultan Qaboos University
College of Engineering
ECE Department
ASCII Hex 3A 30 31 30 36 30 30 36 34 33 41 39 38 43 33 0D 0A
Modbus ASCII Response: 3A 30 31 30 36 30 30 36 34 33 41 39 38 43 33 0D 0A
Problem: 3
Interpret the following request and response message by specifying precisely what is requested
from which slave devices? and what was the response?
Modbus TCP Request: 00 0F 00 00 00 06 01 03 02 58 00 02
TCP 00 0F 00 00 00 06 01 03 02 58 00 02
Format Transaction Protocol Id Length Slave Function Data Number
Id (15) (6 bytes) addres code address of input
s (1) (Read (600 + registers
holding 40001offse (2)
register) t = 40601)
TCP 00 0F 00 00 00 07 01 03 04 03 E8 13 88
Format Transaction Protocol Length Slave Function Length First Second
Id (15) Id (7 bytes) address code (4 register register
(1) (Read bytes) address address
holding (1000) (5000)
register)