Hi, I use Finder OPTA with Arduino PLC IDE.
In first step I defined simple program in LD and read defined variables by my host (by Modbus TCP Client) . That is works.
Next step was defined modbus RTU device slave and try read data fro them .
And here is a problem.
I noticed that when I run poll data by my host (Modbus TCP) then the Modbus RTU stop working.
Any idea what can be wrong?
I have more info.
After executing the program on my OPTA, the slaveNoResponseCount increments to 11 and the slave device status becomes MbError_SlaveLoss (see attached screenshot).
Setting active = TRUE , changing chn to 10, and then reverting chn to its original value restores communication.
This is my temporary to workaround:
// When errors detected
IF (sysMbMRtuNetList[0].slaveNoResponseCount >= 3 OR NOT sysMbMRtuNetList[0].active )
AND NOT recoveryTrigger AND NOT recoveryDone THEN
sysMbMRtuNetList[0].slaveNoResponseCount := 0;
recoveryTrigger := TRUE;
END_IF;
// Recovery sequence
IF recoveryTrigger THEN
handle := sysMbMRtu_GetSlaveHandle(0, 1);
errorRTU := sysMbMRtu_SlaveActivation(0, handle, FALSE); // Deactivate
recoveryTrigger := FALSE;
recoveryDone := TRUE; // Will reactivate on next cycle
ELSIF recoveryDone THEN
handle := sysMbMRtu_GetSlaveHandle(0, 1);
errorRTU := sysMbMRtu_SlaveActivation(0, handle, TRUE); // Reactivate
IF sysMbMRtuNetList[0].chn = 0 THEN
sysMbMRtuNetList[0].chn := 10;
ELSE
sysMbMRtuNetList[0].chn := 0;
END_IF;
recoveryDone := FALSE;
END_IF;