2. OSI Model Modbus
Application Layer
Presentation Layer
Session Layer
Transport Layer
Network Layer
Data Link Layer
Physical Layer
Modbus
NA
NA/Ports
NA/TCP
NA/IP
RS-232/MAC
Serial/Ethernet
Mapping
3. • Published by Modicon in 1979
• Modbus is a Protocol, NOT RS232 or RS485
neither
• Use for communication between individual
equipment
• RTU/ASCII
• Usually over RS232, RS485 or TCP/IP.
• Take TCP 502 port to use
4.
5.
6. • ADU – Application Data Unit
– Maxima size is 256Byte (inherited from RS485)
• PDU – Protocol Data Unit
– Maxima size is 253Byte
(ADU – 1Byte Server Address – 2Byte CRC)
• Use big-endian representation
7.
8. Primary tables Object type Type
Discretes Input Single bit RO
Coils Single bit RW
Input Registers 16- bit word RO
Holding Registers 16- bit word RW
9. • Public
– Data Access (Read/Write)
• Bit Access
• Word Access(16bits)
– Diagnostic
– Other
• User Defined
• Reserved for Exception
(128~255)
10. Code Description Type
Bit
Access
0x01 Read Coils Read
0x02 Read Discrete Inputs Read
0x05 Write Single Coil Write
0x15 Write Multiple Coils Write
Word
Access
(16bits)
0x03 Read Holding Registers Read
0x04 Read Input Register Read
0x06 Write Single Register Write
0x10 Write Multiple Registers Write
11. Code Name
0x01 ILLEGAL FUNCTION
0x02 ILLEGAL DATA ADDRESS
0x03 ILLEGAL DATA VALUE
0x04 SERVER DEVICE FAILURE
0x05 ACKNOWLEDGE
0x06 SERVER DEVICE BUSY
0x08 MEMORY PARITY ERROR
0x0A GATEWAY PATH UNAVAILABLE
0x0B GATEWAY TARGET DEVICE FAILED TO RESPOND