Mitsubishi Electronics MELSEC Q series MELSEC L series Home Theater Server User Manual


 
5-116
5.3 Serial Communication
5.3.15 CPRTCL instruction
G_CPRTCL
Program Example
This instruction executes the protocol specified in Var_ControlData[2] when X20 turns ON.
[Structured ladder/FBD]
[ST]
IF((X20=TRUE) & (X1D=TRUE))THEN
MOV(TRUE, 0, Var_ControlData[1];
(* Store the set value to the send data storage area *)
MOV(TRUE, 1, Var_ControlData[2];(* Designate protocol number 1 *)
GP_CPRTCL(TRUE, H00, 2, 1, Var_ControlData, Var_Result);
(* Execute the protocol Communicate in CH2 *)
END_IF;
IF(Var_Result[0]=TRUE)THEN
IF(Var_Result[1]=FALSE)THEN
SET(TRUE, Var_Flag_Normal);(* Normal completion flag ON *)
ELSE
SET(TRUE, Var_Flag_Abnormal);(* Abnormal completion flag ON *)
MOV(TRUE, Var_ControlData[0], Var_ErrorCode);
(* Store the error code *)
END_IF;
END_IF;
Store the set value to the send
data storage area
Designate protocol number 1
Execute the protocol
Communicate in CH2
Normal completion flag ON
Abnormal completion flag ON
Store the error code