Hello,
How can I read from multiple slaves? I know how to do it for one slave, but how do you handle multiple slaves?
The setup for slave ID 1 is working fine, but I would also like to retrieve the values for IDs 5 and 10.
mySerialMaster : FbMbMasterSerial := ( xConnect := TRUE,
udiBaudrate := 9600,
usiDataBits := 8,
eParity := WagoTypesCom.eTTYParity.Odd,
eStopBits := WagoTypesCom.eTTYStopBits.Two,
eHandshake := WagoTypesCom.eTTYHandshake.None,
ePhysical := WagoTypesCom.eTTYPhysicalLayer.RS485_HalfDuplex,
eFrameType := eMbFrameType.RTU,
tTimeOut := T#3000MS
);
utQuery : typMbQuery := (
bUnitId := 1, // Address
bFunctionCode := 16#03, // FC3 = read input registers
uiReadAddress := 50770,
uiReadQuantity := 2,
uiWriteAddress := 0,
uiWriteQuantity := 0,
awWriteData := [124(0)]
);
xTxTrigger : BOOL; (* Set this variable once to start a job.
This variable will be automatically reset by the master
when the job is completed.
*)
utResponse : typMbResponse; (* Once the job is done, you can find the result in this structure.
*)
tonDelay : TON := (PT := T#50MS); // This is the silence time between two requests
//--- delay between two requests ----------------------
tonDelay( IN := (NOT tonDelay.Q) AND (NOT xTxTrigger));
xTxTrigger S= tonDelay.Q; // trigger the next request
//--- call the master cyclically --------------
mySerialMaster( I_Port := _750_652_x, // my serial port
utQuery := utQuery,
xTrigger := xTxTrigger,
utResponse := utResponse
);
Thank you for your help.