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;