60
5 MODULE DEDICATED INSTRUCTION
5.3 Serial Communication Instruction
Program example
• The following program sends desired data stored in devices from D11 to D15 using the bidirectional protocol. (For the Q
series C24 whose I/O signals are X/Y00 to X/Y1F)
[Structured ladder/FBD]
[ST]
PLS(X20, Var_Flag_Inst); (* Transmission instruction pulse *)
IF(Var_Flag_Inst=TRUE)THEN
MOV(TRUE, H4241, D11); (* Sets send data *)
MOV(TRUE, H4443, D12);
MOV(TRUE, H4645, D13);
MOV(TRUE, H0047, D14);
MOV(TRUE, H0AD, D15);
MOV(TRUE, 1, Var_ControlData[0]); (* Sets transmission channel to 1 *)
MOV(TRUE, 5, Var_ControlData[2]); (* Sets allowable number of words for send data to 5 words *)
G_BIDOUT(TRUE, H0, Var_ControlData, D11, Var_Result); (* Sends data *)
END_IF;
IF(Var_Result[0]=TRUE)THEN (* Execution finished *)
IF(Var_Result[1]=FALSE)THEN (* Normal completion *)
SET(TRUE, Var_Flag_Normal); (* Turns normal completion flag ON *)
ELSE (* Error completion *)
MOV(TRUE, Var_ControlData[1], Var_ErrorCode); (* Stores error code *)
SET(TRUE, Var_Flag_Error); (* Turns error completion flag ON *)
END_IF;
END_IF;
IF(X21=TRUE)THEN
RST(TRUE, Var_Flag_Normal); (* Turns normal completion flag OFF *)
RST(TRUE, Var_Flag_Error); (* Turns error completion flag OFF *)
END_IF;
Transmission
instruction pulse
Sets transmission
channel to 1
Sets number of send
data to 5 words
Sends data
Turns normal completion
flag ON
Stores error code
Turns error completion
flag ON
Turns normal completion
flag OFF
Turns error completion
flag OFF
Sets send data
Содержание MELSEC System Q
Страница 1: ...MELSEC Q L Structured Programming Manual Special Instructions ...
Страница 2: ......
Страница 307: ...10 SFC CONTROL INSTRUCTION 10 2 SFC Transition Condition Comment Read 305 10 MEMO ...
Страница 309: ...I 307 MEMO ...
Страница 315: ......