# Control unit with usage check

If the requested or commanded data is not applied statically and if an individual change should be transferred at this point, the data of the corresponding control unit is provided with an additional usage check.

TYPE MC_CONTROL_UNIT:

STRUCT

request_r : < DATATYPE A >; (* data commanded by GUI *)

enable_w : BOOL; (* PLC operates this command *)

command_w : < DATATYPE A >;(* data commanded by the PLC *)

request_semaphor_rw : BOOL; (* Request valid *)

command_semaphor_rw : BOOL; (* Command valid *)

state_r : < DATATYPE B >; (* CNC feedback *))

END_STRUCT

END_TYPE

Example:

CNC accepts the commanded data if the command semaphore has the value TRUE and sets this element to the value FALSE after complete transfer of the data.

The PLC can write command data if the command semaphore has the value FALSE. Once all command data is written, the PLC sets this command semaphore to the value TRUE.

The CNC writes the data requested by the GUI if the request semaphore is FALSE and then sets this element to TRUE.

The PLC reads the data requested by the GUI if the request semaphore is TRUE. After the PLC fully accepts the data, the PLC sets this element to FALSE.