View
387
Download
1
Category
Preview:
DESCRIPTION
MODBUS
Citation preview
5/28/2018 Modbus Rtu
1/23
Modbus ?Modbus Modbus Master
Modbus slave
Modbus ?
Modbus Open Protocol
Modbus Modbus Protocol Controller
Modbus?Modbus Serial
Serial Master Slave
0 1 Bit ( Voltage) 0 1 Bit
9600 bps (bits per second)
Modbus-RTU Easy Master Function CP1H
Option board RS-232C RS-422A/485 CP1H Modbus-RTU
Master Modbus-RTU software switch Master
Slave PLC inverter temperature control
Gateway mode PLC setting
5/28/2018 Modbus Rtu
2/23
Gateway modeModbus-RTU Master function
Modbus-RTU Master Fucntion CP1H
1. CX-Programmer -> PLC -> Online PLC
2.settingdoubleclick PLC setting
Tab Seria portX( X port option board CP1H port
Slave )
5/28/2018 Modbus Rtu
3/23
5/28/2018 Modbus Rtu
4/23
4. protocol ( )
5. Enable bit Modbus
5/28/2018 Modbus Rtu
5/23
MODBUS Master/Slave
(Master) HMI (Slave) 255 2 (ASCII) (Binary) MODBUS ASCII MODBUS ASCII MODBUS MODBUS RTU
MODBUS 2 ASCII RTU
2
11 (Start) 1 , 8 ,
Parity 1 1 (Stop) 1 Parity
Stop 2 Parity (Even Parity)
http://pongsakrvp.files.wordpress.com/2011/08/chap1modbus_img_12.jpg5/28/2018 Modbus Rtu
6/23
(Odd Parity)
Parity (No Parity)
MODBUS RTUMODBUS ASCII
ASCII RTU RTU 1 ASCII 1 2 0x5B 5 B ASCII 2 035 5 042 B ASCII 2 0x5B 1 RTU
http://pongsakrvp.files.wordpress.com/2011/08/serial_frame_1.jpghttp://pongsakrvp.files.wordpress.com/2011/08/chap1modbus_img_31.jpg5/28/2018 Modbus Rtu
7/23
ASCII RTU ASCII RTU
ASCII ASCII 0x3A : Slave, , , RLC ASCII 2 0x0D 0x0A CR (Carriage Return) LF (Line Feed) ASCII :
MODBUS ASCII
http://pongsakrvp.files.wordpress.com/2011/08/chap1modbus_img_2.jpghttp://pongsakrvp.files.wordpress.com/2011/08/serial_frame_ascii.jpg5/28/2018 Modbus Rtu
8/23
MODBUS ASCII
MODBUS Serial Port (RS-232/422/485) Ethernet
MODBUS Protocol PLCs, DCSs, HMIs, Instruments MODBUS Gateway Bridge Serial Line Ethernet
MODBUS TCP/IP
MODBUS TCP/IP Internet
Ethernet Device ( LAN) 100 Repeater LAN Hub Switch 100 Repeater 100,000,000 (100 Mbps)
http://pongsakrvp.files.wordpress.com/2011/08/chap1modbus_img_2.jpg5/28/2018 Modbus Rtu
9/23
MODBUS TCP/IP
MODBUS ASCII/RTU MODBUS TCP Ethernet Gateway MODBUS RTU/ASCII RS-232/422/485 Gateway MODBUS TCP EthernetModbus Plus (Modbus)
Modbus Slave 4 Discrete On/Off (Coil) (Register)
Coil Register Read-only Read-write
9999 () Coil Contact Discrete Address 0000 270E ( 0 9998)
http://pongsakrvp.files.wordpress.com/2011/08/modbus-tcp-ip_inchassis_schematic.jpg5/28/2018 Modbus Rtu
10/23
Register 16 bits = 2 bytes = 1 word address 0000 270E Data Addresses Coil/Register Numbers Type Table Name
0000 to 270E 1-9999 Read-Write Discrete Output Coils
0000 to 270E 10001-19999 Read-Only Discrete Input Contacts
0000 to 270E 30001-39999 Read-Only Analog Input Registers
0000 to 270E 40001-49999 Read-Write Analog Output Holding Registers
Coil /Register Number Location name Data Address
Register 40001 Data Address 0000 40001 0000 Offset 40001 Offset 1, 10001,30001 40001
Function Code
Slave Network Address 1 247 Master Byte Slave Address Slave
Byte Function Code Table Read
Read / Write
5/28/2018 Modbus Rtu
11/23
Function Code
Function Code Action Table Name
01 ( 01 hex) Read Discrete Output Coils
05 ( 05 hex) Write single Discrete Output Coil
15 ( 0F hex) Write multiple Discrete Output Coils
02 ( 02 hex) Read Discrete Input Contacts
04 ( 04 hex) Read Analog Input Registers
03 ( 03 hex) Read Analog Output Holding Registers
06 ( 06 hex) Write single Analog Output Holding Register
16 ( 10 hex) Write multiple Analog Output Holding Registers
CRC
CRC Cyclic Redundancy Check 2 Byte Message Modbus Protocol Error Byte Message CRC Message CRC CRC Message Bit Message CRC CRC Message Error
5/28/2018 Modbus Rtu
12/23
Modbus Command Response
Function Code
Read Coil Status (FC=01)
Request
01 Function Code Coil On Off Coil 20 56 Slave 17
11 01 0013 0025 0E84
11 : Slave Address (17 = 11 hex )
01 : Function Code (read Coil Status)
0013 : Data Address Coil Coil 1. (Coil 20 - 1 = 19 =13 hex )
0025 : Coil . (coils 20 to 56 = 37 = 25 hex)0E84 : The CRC (cyclic redundancy check) for error checking.
5/28/2018 Modbus Rtu
13/23
Response
11 01 05 CD6BB20E1B 45E6
11 : Slave Address (17 = 11 hex)
01 : Function Code (read Coil Status)
05 : data bytes Coil (37 Coils / 8 bits per byte = 5 bytes )
CD : Coils 20 - 27 ( 1100 1101 ) ( 27|26|25|2423|22|21|20)6B : Coils 28 - 35 ( 0110 1011 )
B2 : Coils 36 - 43 ( 1011 0010 )
0E : Coils 44 - 51 ( 0000 1110 )
1B : Coils 52 - 56 ( 0001 1011 )
45E6 : The CRC (cyclic redundancy check) Coil 36 off ( 0 ) 43 on ( 1 )
37 Coils / 8 bits Coil 57 58 59 000
Read Input Status (FC=02)
Request
ON/OFF Discrete inputs DI Address10197 to 10218 slave Address 17
11 02 00C4 0016 BAA9
11 : Slave Address (17 = 11 hex )
5/28/2018 Modbus Rtu
14/23
02 : Function Code (read Input Status)
00C4 : Data Address Address 10001 (10197 - 10001 = 196 = C4hex)0016 : (197 218 = 22 = 16 hex)BAA9 : CRC (cyclic redundancy check) for error checking.
Response
11 01 03 ACDB35 6418
11 : Slave Address (17 = 11 hex )01 : Function Code (read Input Status)
03 : data bytes (22 Inputs / 8 bits per byte = 3 bytes)AC : Discrete Inputs 10197 - 10204 ( 1010 1100 )
DB : Discrete Inputs 10205 - 10212 ( 1101 1011 )
35 : Discrete Inputs 10213 - 10218 ( 0011 0101 )
6418 : The CRC (cyclic redundancy check).
DI Address 10197 off ( 0 ) 10204 on ( 1 ) Address 10219 10220
Function Code 03 06 15 16 Link
Data Addresses Read Write Single Write Multiple
Discrete Output Coils 0xxxx FC01 FC05 FC15
Discrete Input Contacts 1xxxx FC02 NA NA
Analog Input Registers 3xxxx FC04 NA NA
Analog Output Holding Registers 4xxxx FC03 FC06 FC16
http://www.simplymodbus.ca/FC01.htmhttp://www.simplymodbus.ca/FC01.htmhttp://www.simplymodbus.ca/FC05.htmhttp://www.simplymodbus.ca/FC05.htmhttp://www.simplymodbus.ca/FC15.htmhttp://www.simplymodbus.ca/FC15.htmhttp://www.simplymodbus.ca/FC02.htmhttp://www.simplymodbus.ca/FC02.htmhttp://www.simplymodbus.ca/FC04.htmhttp://www.simplymodbus.ca/FC04.htmhttp://www.simplymodbus.ca/FC03.htmhttp://www.simplymodbus.ca/FC03.htmhttp://www.simplymodbus.ca/FC06.htmhttp://www.simplymodbus.ca/FC06.htmhttp://www.simplymodbus.ca/FC16.htmhttp://www.simplymodbus.ca/FC16.htmhttp://www.simplymodbus.ca/FC16.htmhttp://www.simplymodbus.ca/FC06.htmhttp://www.simplymodbus.ca/FC03.htmhttp://www.simplymodbus.ca/FC04.htmhttp://www.simplymodbus.ca/FC02.htmhttp://www.simplymodbus.ca/FC15.htmhttp://www.simplymodbus.ca/FC05.htmhttp://www.simplymodbus.ca/FC01.htm5/28/2018 Modbus Rtu
15/23
Protocol Converter (Modbus TCP/IP to Modbus RTU)
(User Manual)
Model : MPL-J012
l 23x 80mm 100mm DIN Rail Mount
2 Protocol Modbus TCP/IP (Master) Modbus RTU (Slave)
3 Serial Modbus RTU Modbus TCP/IP
Network Serial
4 LAN RS485Modbus Network
LAN , Wireless LAN
5 RS485 1Port
6 RJ45 Ethernet TCP/IP HUB Access Point / Wireless LAN
7 Web Based User Interface Config Parameter IP Address, Subnet Mask Default
Gateway
MPL-J01 = Modbus TCP/IP to Modbus RTU protocol
MPL-J04 = Modbus RTU to Modbus TCP/IP protocol
MPL-J02 = Modbus TCP/IP to Mitsubishi PLC (Computer Link protocol)
MPL-J03 = Modbus TCP/IP to Omron PLC (Host Link Protocol)3
5/28/2018 Modbus Rtu
16/23
WIRING DIAGRAM
1) SET INTERNET PROTOCOL(TCP/IP) IP ADDRESS
192.168.0.XXX XXX
244 PROTOCOL CONVERTER IP ADDRESS 192.168.0.244
DEFAULT
2) INTERNET EXPLORER IP ADDRESS 192.168.0.244
USER NAME
PASSWORD USER NAME : admin PASSWORD CLICK OK4
5/28/2018 Modbus Rtu
17/23
3) WEB PAGE
NETWORK Click Network Config Network
3.1Device Name Device ,
3.2IP Address IP Device , Ethernet Port (RJ45)
USER
Modbus TCP/IP ( TELE-PLC , FacLink Scada software )
Default : 192.168.0.244
3.3Subnet mask Subnet Device 255.255.255.0
3.4Default gateway NETWORK
3.5DHCP Client Enable NO / YES ( NO )
Auto IP PROTOCOL CONVERTER Boardcast Computer Server IP Address
IP Address Protocol Converter IP Adress
3.6Ethernet Link Ethernet Port AUTO/ 10/100Mbit/sec
( Auto )
5/28/2018 Modbus Rtu
18/23
3.7Physical Address ID HARDWARE
LAN
Change Page RAM PARAMETER
SAVE & REBOOT ( Page SYSTEM CONFIG )
IP , User Name Password
RESET : TERMINAL 10 (
Dimension)
IP 192.168.0.244
User name admin
Password: 5
Protocol Converter
4) Click Serial (RS485)
RS4856
4.1Baud Rate Slave Node
4.2Data Length Slave Node
4.3Parity Bit Parity Bit Slave Node
4.4Stop Bit Stop Bit Slave Node
5/28/2018 Modbus Rtu
19/23
Change Page RAM PARAMETER
SAVE & REBOOT ( Page SYSTEM CONFIG )
5) Click System Configuration
USER
NAME PASSWORD WEB PAGE
5.1Save and Reboot Device Protocol Converter
RAM
FLASH MEMORY Reboot
5.2Restore factory default (
)
5.3Change Password user name password web page Data logger
User name admin Password:
IP , User Name Password
RESET : TERMINAL 10 (Dimension)
IP 192.168.0.244
User name admin
Password:
5/28/2018 Modbus Rtu
20/23
Memory Map
Protocol Converter Modbus TCP/IP Modbus RTU Device Device Protocol Converter
Modbus TCP/IP Master Modbus Protocol
Function 01 /02 /03 /04
5/28/2018 Modbus Rtu
21/23
5/28/2018 Modbus Rtu
22/23
1 MPL-J01Modbus TCP/IP to Modbus RTU
*** : MASTER DEVICE Modbus TCP/IP Protocol , Slave Device Modbus RTU
5/28/2018 Modbus Rtu
23/23
2 MPL-J04Modbus RTU to Modbus TCP/IP
*** : MASTER DEVICE Modbus RTU Protocol , Slave Device Modbus TCP/IP
Recommended