Evaluate the COM port reset requested
This instruction returns the value of the reset requested flag of a specified COM port.
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
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
fbResetComPort: ResetComPort;
bResetComPort: BOOL:=FALSE;
iPort: INT:=0;
bComPortCannotBeUsed: BOOL:=FALSE;
bIsResetRequested: 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 = 5 ;
NETWORK_BODY
B(B_VARIN,,iPort,19,3,21,5,);
B(B_CONTACT,,bResetComPort,6,2,8,4,);
B(B_FB,ResetComPort!,fbResetComPort,21,1,29,5,,BbResetBPortAbIsDoneAbIsRequest);
L(1,3,6,3);
L(8,3,21,3);
L(1,0,1,5);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE = NWTYPELD ;
NETWORK_LABEL = ;
NETWORK_TITLE = ;
NETWORK_HEIGHT = 3 ;
NETWORK_BODY
B(B_VARIN,,iPort,19,1,21,3,);
B(B_COIL,,bComPortCannotBeUsed,39,1,41,3,S);
B(B_F,IsRequestComPortReset!,,21,0,33,3,,DPortC);
L(1,0,1,3);
L(33,2,39,2);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE = NWTYPELD ;
NETWORK_LABEL = ;
NETWORK_TITLE = ;
NETWORK_HEIGHT = 3 ;
NETWORK_BODY
B(B_VARIN,,iPort,19,1,21,3,);
B(B_COIL,,bComPortCannotBeUsed,39,1,41,3,E);
B(B_F,IsComPortResetDone!,,21,0,32,3,,DPortC);
L(32,2,39,2);
L(1,0,1,3);
END_NETWORK_BODY
END_NET_WORK
NET_WORK
NETWORK_TYPE = NWTYPELD ;
NETWORK_LABEL = ;
NETWORK_TITLE = ;
NETWORK_HEIGHT = 6 ;
NETWORK_BODY
B(B_COMMENT,,Valid numbers for iPort ø^ COM Ports on CPU unit COM0~ COM1~ COM2~ ø^ COM Ports on SCU unit 16#xx01 ... 16#xx04 - xx = slotnumber 1...64,8,1,45,5,);
L(1,0,1,6);
END_NETWORK_BODY
END_NET_WORK
END_BODY
If (bResetComPort) then
fbResetComPort(bReset := bResetComPort,
Port := iPort);
End_if;
If (IsRequestComPortReset(iPort)) then
bComPortCannotBeUsed := TRUE;
Elsif (IsComPortResetDone(iPort)) then
bComPortCannotBeUsed := FALSE;
End_if;