Appendix: flow charts showing the operation of the device
Flow chart: command processing
Hans Turck GmbH & Co. KG | T +49 208 4952-0 | more@turck.com | www.turck.com
07.00 | 2022/09 | 279
15.1.1 Handling command execution with Busy and Error — sample code in CODESYS
The following is a sample code for evaluation in the PLC program.
commandCode: INT;
responseCode: INT;
responseCodePrevious: INT;
commandCode:= 0x0002; (* READ *)
(* … PLC cycle … *)
IF (responseCode <> responseCodePrevious) THEN
IF (responseCode < 0) THEN
(* BUSY *)
ELSE
IF (responseCode == commandCode) THEN
(* success *)
ELSIF (0x8000 == commandCode) AND (0x0000 == responseCode) THEN
(* reset success *)
ELSE
(* error *)
END_IF;
END_IF;
responseCodePrevious:= responseCode;
END_IF;