KonstantinKolev
Member
OP
Hi,
These days I decided to move the energymeters to a separate Modbus RTU module on the WAGO PFC 200. The module is 750-653/003-000.
This is the module: 750-653
My energymeters are: 1 is ELNET and 5 are NOARK
I have been struggling with getting the data in the WAGO, there is always 0 on all of data I read despite the fact that there is NO error in the function.
The library I use is WagoAppPlcModbus 1.1.3.4.
I also polled one of energymeter with CAS Scanner and it responded. Then I sniffed the poll and response on the WAGO and it is identical to the poll and response on the CAS Scanner. The only energymeter that responded on the CAS Scanner is the ELNET. Noark energymeter do NOT respond on the CAS Scanner.
You can find the code below, I used the example from the help file and modified according to my needs.
I used a separate bit for xConnect since in other forums they claim that if it is initialised as TRUE there are problems with the library for some versions.
Basically there is NO data in the utResponse, there is NO error on output of the function and the sniffing data is the same as the data in the CAS Scanner.
Best Regards
Konstantin Kolev
These days I decided to move the energymeters to a separate Modbus RTU module on the WAGO PFC 200. The module is 750-653/003-000.
This is the module: 750-653
My energymeters are: 1 is ELNET and 5 are NOARK
I have been struggling with getting the data in the WAGO, there is always 0 on all of data I read despite the fact that there is NO error in the function.
The library I use is WagoAppPlcModbus 1.1.3.4.
I also polled one of energymeter with CAS Scanner and it responded. Then I sniffed the poll and response on the WAGO and it is identical to the poll and response on the CAS Scanner. The only energymeter that responded on the CAS Scanner is the ELNET. Noark energymeter do NOT respond on the CAS Scanner.
You can find the code below, I used the example from the help file and modified according to my needs.
I used a separate bit for xConnect since in other forums they claim that if it is initialised as TRUE there are problems with the library for some versions.
Basically there is NO data in the utResponse, there is NO error on output of the function and the sniffing data is the same as the data in the CAS Scanner.
Code:
PROGRAM ModbusRS485
VAR
mySerialMaster: FbMbMasterSerial;
utQuery: typMbQuery := (bUnitId := 26, // Slaveaddress
bFunctionCode := 16#04, // read input registers
uiReadAddress := 0, // Startaddress
uiReadQuantity := 2, // Quantity of wanted registers
uiWriteAddress := 0, // not needed for FC4
uiWriteQuantity := 0, // not needed for FC4
awWriteData := [124(0)] // not needed for FC4
);
xTxTrigger: BOOL; (* Set this variable once for start a job. This variable will be automaticly reset by the master if the job is done.*)
utResponse : typMbResponse; // After the job is done you can find at this structure the result.
tonDelay: TON := (PT := T#500MS); // This is the silence time between two requests
xConnect: BOOL;
END_VAR
//--- delay between two requests ----------------------
tonDelay( IN := (NOT tonDelay.Q) AND (NOT xTxTrigger));
xTxTrigger := tonDelay.Q; // trigger the next request
//--- call cyclic the master --------------
mySerialMaster( xConnect := xConnect,
I_Port := RS485_Interface_Adjust, // my serial port
udiBaudrate := 9600,
usiDataBits := 8,
eParity := eTTYParity.None,
eStopBits := eTTYStopBits.One,
eHandshake := eTTYHandshake.None,
ePhysical := eTTYPhysicalLayer.RS485_HalfDuplex,
eFrameType := eMbFrameType.RTU,
tTimeOut := T#1000MS,
utQuery := utQuery,
xTrigger := xTxTrigger,
utResponse := utResponse,
xIsConnected => ,
xError =>,
oStatus =>
);
//-----------------------------------------
Best Regards
Konstantin Kolev
Last edited: