EasyManua.ls Logo

Beckhoff CX90 0 Series - Terminal Bus Analysis in PLC Program

Beckhoff CX90 0 Series
61 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
Error handling and diagnostics
44 Embedded PC
Terminal Bus Analysis in PLC-Program
To analyze the terminal bus (K-Bus) the programmer can access the registers described in the architecture. The
access to the PLC-program is realized via TwinCAT. The registers are described in the architecture of the terminal
bus connectors (CX1100-000x.
For analysis four signals / variables are used:
BusState (describes the state of the bus: 0 -> no error, 1 -> bus error)
ErrorCode (same error code as the LED blink code)
ErrorArg (same argument code LED blink code)
Request[0] (output to request error codes / reset bus)
In the PLC program some external variables must be defined:
VAR
k_bus_request AT %QX0.0 : BOOL;
k_bus_err_code AT %IB0 : USINT;
k_bus_err_arg AT %IB1 : USINT;
k_bus_state AT %IB2 : USINT;
END_VAR
In the PLC program the analysis can be done as follows: (this is only pseudo code)
....
IF k_bus_state = 1 THEN (* an error occured on K-Bus*)
k_bus_request := TRUE; (* request vaules for ErrCode and ErrArg *)
CASE k_bus_err_code OF
0 : return; (* should not happen, though an error occured *)
1 : CASE k_bus_arg OF
0 : report error; (* EEPROM checksum error *)
1 : report error; (* overflow in code buffer *)
2 : report error; (* unknown datatype *)
END_CASE;
2 : CASE k_bus_arg OF
0 : report error; (* programmed configuration, wrong table entry *)
ELSE report error; (* wrong table entry *)
END_CASE;
3 : report error (* K-Bus command error *)
4 : CASE k_bus_arg OF
0 : report error; (* break after power supply *)
ELSE report error; (* break after terminal 'k_bus_arg' *)
END_CASE;
5 : report error (* K-Bus-error during register-communication with
terminal 'k_bus_arg' *)
9 : CASE k_bus_arg OF
0 : report error; (* checksum error in program flash *)
ELSE report error; (* terminal 'k_bus_arg' does not exist in boot
configuration *)

Related product manuals