安裝GX Works3 (僅設定RS485,與它通訊的電腦可以不用安裝)
更新GX Works3 (否則會沒有FX5U可以選)
將FX5U 與 電腦接到Hub上
(我電腦網段在192.168.0.XXX,PLC 在192.168.3.XXX,不影響連線)
開啟GX Works3
新增專案
連線
在連線雙擊滑鼠左鍵
連線測試
設定MODBUS
到參數→FX5UCPU→模組參數→RS485串列埠,雙擊滑鼠左鍵
選擇MODBUS_RTU 通訊
設定站號
寫到PLC
重開PLC,GX Work3可以拋到一旁去了,
我透過自己寫的PC小程式去測試通訊
送碼測試指令整理
01H,讀取M0:
Send:010120000001F60A
Receive:01010100F188 (M0為OFF)
01H,讀取M0~M7:
Send:010120000008360C
Receive:010101005188 (M0~M7為OFF)
01H,讀取M0~M15:
Send:0101200000103606
Receive:010102FF00F80C (M0~M7為ON M8~M15為OFF)
03H,讀取D0:
Send:010300000001840A
Receive:0103020000B844 (D0為0)
03H,讀取D0~D1:
Send:010300000002C40B
Receive:01030400640000BBEC (D0~D1為0)
05H,寫入M0 ON:
Send:01052000FF0087FA
Receive:01052000FF0087FA
05H,寫入M0 OFF:
Send:010520000000C60A
Receive:010520000000C60A
06H,寫入D0:
Send:0106000000648821
Receive:0106000000648821
0FH,寫入M0~M7 ON
Send:010F2000000801FFB9B5
Receive:010F200000085FCD
10H,寫入D0=100, D1=200
Send:01100000000204006400C8B3E6
Receive:01100000000241C8
功能代碼:
01H 讀取多個暫存器(Bit型)
03H 讀取多個暫存器(Word型)
05H 寫入單一暫存器(Bit型)
06H 寫入單一暫存器(Word型)
0FH 寫入多個暫存器(Bit型)
10H 寫入多個暫存器(Word型)
MODBUS地址(Bit型暫存器)
0000H~03FFH Y0~1023
2000H~3DFFH M0~7679
5000H~57FFH SM0~2047
5800H~75FFH L0~7679
7800H~78FFH B0~255
9800H~987FH F0~127
A000H~A0FFH SB0~255
B000H~BFFFH S0~4095
D000H~D1FFH TC0~511
D800H~D9FFH TS0~511
E000H~E00FH SC0~15
E800H~E80FH SS0~15
F000H~F0FFH CC0~255
F800H~F8FFH CS0~255
MODBUS地址(Word型暫存器)
0000H~1F3FH D0~7999
5000H~770FH SD0~9999
7800H~79FFH W0~512
A000H~A0FFH SW0~512
D000H~D1FFH TN0~511
E000H~E00FH SN0~15
F000H~F0FFH CN0~255
相關文章:
留言列表