Set communication mode
This instruction sets the communication mode to “MEWTOCOL-COM slave”/“MEWTOCOL-COM master/slave”.
Input
Specifies the communication ports depending on the PLC type:
COM port e.g. SYS_COM0_PORT
MCU/SCU e.g. 16#xx01 (xx = slot number) in COM01
When the power is turned on, the communication mode selected in the system registers is set.
It is not possible to change to Modbus RTU mode or PLC Link mode during RUN mode.
All input and output variables used for programming this function have been declared in the POU header. The same POU header is used for all programming languages.
VAR
bEnableMEWTOCOL: BOOL:=FALSE;
iPort: INT:=0;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 4 ;
NETWORK_BODY
B(B_F,E_SetMEWTOCOL!,,17,0,26,4,,?DEN?DPort?AENO);
B(B_VARIN,,iPort,15,2,17,4,);
B(B_CONTACT,,bEnableMEWTOCOL,6,1,8,3,R);
L(1,2,6,2);
L(8,2,17,2);
L(1,0,1,4);
END_NETWORK_BODY
END_NET_WORK
END_BODY
IF DF(bEnableMEWTOCOL) then
SetMEWTOCOL(Port := iPort);
END_IF;