Hi all!
I'm having a hard time using the MODBUS RTU interface on the AC 500 and would appreciate any hint:
The application is running several programs (POUs) written in ST. Program A (cyclic, priority 20, @ 500 ms) implements a set of synchronization flags and CASE statement used to select different Modbus requests and feed them to the COM_MOD_MAST block in program B and set the event triggering program B. Program B (event triggered, priority 10) basically consists of a COM_MOD_MAST block and some synchronization logic to notify program A that the request is processed.
So far everything runs fine, but when I cut the RS485 connection to any/all of the MODBUS slaves DONE and ERR in the COM_MOD_MAST are not affected, and regardless of the TIMEOUT parameter the COM_MOD_MAST gets executed immediately (I measured the time before and after the COM_MOD_MAST it's < 1 ms). When I set a breakpoint at the statement containing the COM_MOD_MAST the DONE and ERR parameters are set correctly, but at the next statement they are gone. I tried assigning DONE and ERR to global variables:
MBTxRq(EN:=TRUE,    COM:=2,    SLAVE:=MBSlaveDvADR,    FCT:=FunctCode,    TIMEOUT:=MB_COMM_TOUT,    ADDR:=MBSlaveRqAddr,    NB:=MBRxLngth,    DATA:=MBRxDataAdr,    DONE=>Mod_Done,    ERR=>Mod_Error,    ERNO=>Mod_ErrNum);
without success. Waiting for MBTxRq.ERNO to get nonzero was no help either.
Even using F_TRIG/R_TRIG available in the library in order to capture ERR and DONE was no cure.
The manual says: "After completing or aborting the processing (due to an error), DONE is set to TRUE for one cycle." - no idea what does cycle mean in this case?!?!
Thnx in advance!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
occam hat geschrieben:
The manual says: "After completing or aborting the processing (due to an error), DONE is set to TRUE for one cycle." - no idea what does cycle mean in this case?!?!
You have to do then check for DONE and ERR in program B.
a Cycle in this case is at then from fiste time it hit COM_MOD_MASTER to then then next time..
Flændsdal
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi all!
I'm having a hard time using the MODBUS RTU interface on the AC 500 and would appreciate any hint:
The application is running several programs (POUs) written in ST.
Program A (cyclic, priority 20, @ 500 ms) implements a set of synchronization flags and CASE statement used to select different Modbus requests and feed them to the COM_MOD_MAST block in program B and set the event triggering program B.
Program B (event triggered, priority 10) basically consists of a COM_MOD_MAST block and some synchronization logic to notify program A that the request is processed.
So far everything runs fine, but when I cut the RS485 connection to any/all of the MODBUS slaves DONE and ERR in the COM_MOD_MAST are not affected, and regardless of the TIMEOUT parameter the COM_MOD_MAST gets executed immediately (I measured the time before and after the COM_MOD_MAST it's < 1 ms). When I set a breakpoint at the statement containing the COM_MOD_MAST the DONE and ERR parameters are set correctly, but at the next statement they are gone. I tried assigning DONE and ERR to global variables:
without success. Waiting for MBTxRq.ERNO to get nonzero was no help either.
Even using F_TRIG/R_TRIG available in the library in order to capture ERR and DONE was no cure.
The manual says: "After completing or aborting the processing (due to an error), DONE is set to TRUE for one cycle." - no idea what does cycle mean in this case?!?!
Thnx in advance!
You have to do then check for DONE and ERR in program B.
a Cycle in this case is at then from fiste time it hit COM_MOD_MASTER to then then next time..
Flændsdal