Skip to content

Instantly share code, notes, and snippets.

@themachinist
Last active December 11, 2023 10:28
Show Gist options
  • Save themachinist/29e2ee5fd70b8b40e7d2 to your computer and use it in GitHub Desktop.
Save themachinist/29e2ee5fd70b8b40e7d2 to your computer and use it in GitHub Desktop.
Siemens 840d Automated Tool Length Setting
; Automated tool length measurement
; Siemens 840d (Tested on DMU50)
; This program will call every tool into the main spindle and run a blum
; laser measuring cycle designed to record the tool length offset of the tool
; I've included citations of the manual pages I referenced to find the pieces
; of data used in the program
; See the manual SINUMERIK 840D sl / 828D Job Planning for information on the
; high-level nc language
DEF INT _i
DEF INT _t
; $P_TOOLNT a count of the number of tools defined in NCK [1]
; $A_TOOLMN[n] magazine number of tool n [2]
; $TC_DP1[c,t] code representing tool type (mill,drill, [3]
; probe,etc) of cutting edge c on tool t
; $TC_TP2[t] tool identifier string [4]
FOR _i = 1 to $P_TOOLNT
; store tool number
_t = $P_TOOLT[_i]
; if the tool is located in any magazine
IF $A_TOOLMN[_t] > 0
; if the tool type is NOT any kind of probe or aux
IF $TC_DP1[_t, 1] < 710
; load tool by identifier
T=$TC_TP2[_t] M6
; turn spindle slowly
S1200 M3
; laser measuring cycle
BL9902(3,0.002,0,3,0.0004)
ENDIF
ENDIF
ENDFOR
M30
; 1. SINUMERIK 840D sl Tool Management, sec. 5.8.46, pp. 336
; 2. SINUMERIK 840D sl Tool Management, sec. 5.8.36, pp. 325
; 3. SINUMERIK 840D sl Tool Management, sec. 5.3.2, pp. 239
; 4. SINUMERIK 840D sl Tool Management, sec. 5.2.2, pp. 232
@PepijnMat
Copy link

Why do you use line 27: $TC_DP1[_t, 1] < 710, to determine if the tool type is not a probe or aux? What does the number 710 have to do with this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment