评估COM端口重置是否完成
此指令返回指定通信端口上重置完成标志的值。
输入
根据PLC的类型指定通信端口:
COM端口,例如SYS_COM0_PORT
MCU/SCU,例如COM01中的16#xx01(xx = 插槽编号)
所有用于编程此函数的输入和输出变量已在POU头中声明。 所有编程语言使用相同的POU头。
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;