Setting COMx - MultiΒΆ

Note

For PM55x and PM56x, the interface COM2 cannot be configured as COM2 - Multi.

If the protocol COMx - Multi is set for the serial interface COMx, the interface is prepared for operation with 2 selectable protocols.

  1. In the device tree, append the desired protocols to the COMx - Multi node (Add object).

  2. Modify the parameters for the appended protocol nodes.

    The protocol parameters are identical to the parameters described for the individual protocols.

When restarting the program, i.e. after switching power ON, a download or a reset, the protocol appended first is always active.

Switching between the protocols is done using the Function Block COM_SET_PROT (contained in the library SysInt_AC500_V10.lib). At the Function Block input COM, the number of the serial interface is applied and at the input IDX the protocol index is set. The protocol appended first in the PLC configuration has the index 0, the second protocol the index 1.

Call of block COM_SET_PROT in system events

FUNCTION callback_Start: DWORD

VAR_INPUT

dwEvent : DINT;

dwFilter: DINT;

dwOwner : DINT;

END_VAR

COM_SET_PROT(EN := FALSE); (* for edge creation *)

COM_SET_PROT(EN := TRUE, COM := 2, IDX := 1); (* switch to Modbus *)

FUNCTION callback_Stop : BOOL

VAR_INPUT

dwEvent : DINT;

dwFilter: DINT;

dwOwner : DINT;

END_VAR

COM_SET_PROT(EN := FALSE); (* for edge creation *)

COM_SET_PROT(EN := TRUE, COM := 2, IDX := 0); (* switch to Online access *)