Information to PLC
Tool change
With every programmed T<i> or #TOOL PREP, the CNC communicates the tool number to the PLC during NC program decoding, provided this function is activated in the channel parameter list (P-CHAN-00087).
This advance information can be used by the external tool management system to prepare a tool change (cleaning the tool, turning the disk changer, etc.) to save time.
The following data (CNC_TOOL_ID) is transferred in the request from the CNC to the PLC; the T number is entered in the basic element:
basic | : DINT; |
sister | : DINT; |
variant | : DINT; |
sister_valid | : BOOL; |
variant_valid | : BOOL; |
The PLC must acknowledge receipt by returning the identical message.
Programming Example
Tool manager in the PLC program
...
(* CNC communicates tool change T<i> (during program decoding) *)
ELSIF RInd.IDXGRP = ADS_IGRP_TOOL_INFO_WRITE THEN
(* CNC writes tool life data *)
pTid := RInd.DATAADDR;
BasicToolId := pTid^.basic;
IF BasicToolId <= MAX_TOOLS THEN
(* save actual requested tool T<nr> *)
(* Tool id in valid range *)
RRes.LEN := SIZEOF(pTid^);
RRes.DATAADDR := pTid;
RRes.RESULT := ADS_RDWRT_IND_NO_ERROR;
ELSE
(* no data transmitted in the response *)
RRes.LEN := 0;
RRes.DATAADDR := 0;
RRes.RESULT := WZV_TOOL_ID_BASIC_INVALID;
END_IF
ELSE