Toggle communication mode
Input
Send buffer
Number of bytes to send:
Negative value: The end code selected in the system registers is not appended to the send string.
0 (zero bytes): Prepare system to receive further data
16#8000: Toggle communication mode
Specifies the communication ports depending on the PLC type:
COM port e.g. SYS_COM0_PORT
Ethernet port e.g. SYS_ETHERNET_USER_CONNECTION_1
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
bSwitchToMewtocolSlave: BOOL:=FALSE;
wDummy: WORD:=0;
bSwitchToProgramControlled: BOOL:=FALSE;
END_VAR
BODY
WORKSPACE
NETWORK_LIST_TYPE := NWTYPELD ;
ACTIVE_NETWORK := 0 ;
END_WORKSPACE
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 9 ;
NETWORK_BODY
B(B_COMMENT,,Changing COM 1 from program controlled to MEWTOCOL-COM Slave mode.ø^The corresponding transmission mode flag R9032 (sys_bIsComPort1ProgramControlled) is setø^when program controlled mode is selected.,1,0,39,3,);
B(B_VARIN,,wDummy,26,5,28,7,);
B(B_VARIN,,16#8000,26,6,28,8,);
B(B_F,F159_MTRN!,,28,3,36,9,,?DEN?Ds_Start?Dn_Number?Dd_Port?AENO);
B(B_VARIN,,SYS_COM1_PORT,26,7,28,9,);
B(B_CONTACT,,bSwitchToMewtocolSlave,6,4,8,6,R);
B(B_CONTACT,,sys_bIsComPort1ProgramControlled,19,4,21,6,);
L(1,5,6,5);
L(8,5,19,5);
L(21,5,28,5);
L(1,0,1,9);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE := NWTYPELD ;
NETWORK_LABEL := ;
NETWORK_TITLE := ;
NETWORK_HEIGHT := 7 ;
NETWORK_BODY
B(B_COMMENT,,Changing COM 1 from MEWTOCOL-COM Slave to program controlled mode.,1,0,30,1,);
B(B_VARIN,,wDummy,26,3,28,5,);
B(B_VARIN,,16#8000,26,4,28,6,);
B(B_F,F159_MTRN!,,28,1,36,7,,?DEN?Ds_Start?Dn_Number?Dd_Port?AENO);
B(B_VARIN,,SYS_COM1_PORT,26,5,28,7,);
B(B_CONTACT,,sys_bIsComPort1ProgramControlled,19,2,21,4,N);
B(B_CONTACT,,bSwitchToProgramControlled,6,2,8,4,R);
L(8,3,19,3);
L(21,3,28,3);
L(1,3,6,3);
L(1,0,1,7);
END_NETWORK_BODY
END_NET_WORK
END_BODY
(* Changing COM 1 from program controlled to MEWTOCOL-COM Slave mode.
The corresponding transmission mode flag R9032 (sys_bIsComPort1ProgramControlled) is set
when program controlled mode is selected. *)
if (DF(bSwitchToMewtocolSlave) AND sys_bIsComPort1ProgramControlled) then
F159_MTRN(s_Start := wDummy, n_Number := 16#8000, d_Port := SYS_COM1_PORT);
end_if;
(* Changing COM 1 from MEWTOCOL-COM Slave to program controlled *)
if (DF(bSwitchToProgramControlled) AND NOT sys_bIsComPort1ProgramControlled) then
F159_MTRN(s_Start := wDummy, n_Number := 16#8000, d_Port := SYS_COM1_PORT);
end_if;