modbus tcp slave not responding?
My automation builder looks like this:
https://snag.gy/t1UhjS.jpg
And my code in codesys looks like this
https://snag.gy/HZAj1y.jpg
in which modbus_register_x is addressed at position %M0.0.x
and DOx is the output pins on the PLC.
I guess i miss some functionality that act on the Modbus Master request.. Everytime i tried to connect to it using Modbus master simulators (Modpoll) I run into a timeout. It somehow makes sense since, I am not doing anything specific to resolve the request.
So how do I resolve the request comming from the Master? how do I respond?
Voted best answer
Some questions: is DO0 = True (always) ? PLC must be in Run.
Have you udated the firmware to 2.5?
with Modscan32 (modbus poll have problems) I can write addreses from 01 to 10 on Device ID=1 function 01=coil status and I can turn on and off the corresponding leds on PLC.
Don't forget to create boot project before turn off the PLC...
Answers
Hi I can't see the AT declarations in global variables..I imagine you haven't download any modbus tcp IP exmple from ABB...
You have to assign your variables like that in the program PLC_PRG:
inputs:
%MX0.0.0:=DI0_; (*COIL STATO INPUT 0 00001*)
%MX0.0.1:=DI1_; (*COIL STATO INPUT 1 00002*)
%MX0.0.2:=DI2_; (*COIL STATO INPUT 2 00003*)
outputs:
Output_2:=%MX0.1.2; (*COIL COMANDO OUTPUT 2 00011*)
Output_3:=%MX0.1.3; (*COIL COMANDO OUTPUT 3 00012*)
and als you can expose your global variables to modbus Poll :
HBTAT %MW0.2: WORD; (* contatore word heartbeat *)
CPULOAD_AVAT %MW0.4: WORD; (* carico medio della CPU *)
CPU_ERNOAT %MW0.5: WORD; (* numero errore della CPU *)
CPU_ERR AT %MX0.100.0: BOOL; (* stato di errore della CPU *)
How did you config ETH port and Modbus_Server protocol?
Do you have the PLC in running mode?
Do you include your PLC code to some task to be executed?
Set fixed time of your task (cyclic), e.g. 100 ms (not freewheeling)
Did you ping your PLC from the PC? Your PC card should have the same subnet mask and network area.
Try to put %MX0.0.0:= output of BLINK (1 sec = true, then 1 sec = false)
Addressing (type Modbus address table in your help):
%MW0.0 is word 0, dec 0
%MX0.0.0 is bit 0 from word 0
%MX0.1.0 is bit 8 from word 0
Go to the modbus tcp/ip server protocol in automation builder which you should have added to the prtocol section of the ethernet port. Double click and set the number of server connections to a number higher then 0 e.g. 2.
If you have a slow scan cycle eg. 1000ms in your master make task timeout and OM time larger.
Add new comment