Function Block COM_SET_PROT¶
Function Block COM_SET_PROT: COM_SET_PROTMODBUS (master):
In the device tree, append the COM2 - Multi protocol to the COM2 node (
Add object
).Append the COM2 - Online Access protocol to the COM2 - Multi node (Protocol with index 0).
Append the COM2 - Modbus protocol to the COM2 - Multi node (Protocol with index 1).
- ⇒
Set the system events START and STOP in the task configuration:
- ⇒
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 *)