TNC 620 Tables & System Data

On a TNC 620 nearly everything that isn’t an NC block lives in a table: tools, magazine pockets, presets, datums, probe data, your own .TAB files. The control gives an NC program four distinct doors into this data — FN 26/27/28 for your own tables, SQL statements for anything, TABDATA for the active tool and compensation tables, and FN 18 SYSREAD for live system data — plus FN 16 F-PRINT to get results back out as formatted reports.

The Table Landscape

TableFileWhat’s in it
Tools & probes
Tool tableTOOL.T in TNC:\table\The central tool file (archive copies use other names with .T). Geometry: L, R, R2, deltas DL/DR/DR2; management: NAME, TL (locked), RT (replacement tool), TIME1/TIME2/CUR_TIME (tool life), DOC, NMAX, LIFTOFF, LCUTS, LU, ANGLE, T-ANGLE, PITCH, RCUTS, R_TIP, KINEMATIC, TP_NO (link to probe table); TT measurement: CUT, LTOL, RTOL, R2TOL, DIRECT, R-OFFS, L-OFFS, LBREAK, RBREAK
Pocket tableTOOL_P.TCH in TNC:\table\Magazine assignment for automatic tool change: P (pocket), T (tool number), RSV (reservation), ST (special tool), F (fixed pocket), L (locked), PTYP, box-magazine locks LOCKED_ABOVE/BELOW/LEFT/RIGHT. Name/path/content amendable by the machine builder
Touch probe tabletchprobe.tpPer-probe data: TYPE, center offsets CAL_OF1/CAL_OF2, CAL_ANG, probing feed F, positioning FMAX, max range DIST, SET_UP, F_PREPOS, TRACK, STYLUS (SIMPLE / L-TYPE)
Work coordinates
Preset tablePRESET.PR in TNC:\table\Presets as basic transformation (X, Y, Z plus basic rotation SPA/SPB/SPC) and an OFFSET view for axis offsets. Row 0 always holds the last manually set preset (PR MAN(0)). Rows can be write-protected, even by password. Activate via Cycle 247 or PRESET SELECT #n; correct from a program with PRESET CORR
Datum tables*.DWorkpiece datums referenced to the current preset (columns D, XW, DOC); select with SEL TABLE before Cycle 7 / TRANS DATUM
Program-facing tables
Compensation tables*.tco, *.wco.tco compensates in the tool coordinate system (alternative to DL/DR/DR2 in TOOL CALL — and it overrides them), .wco shifts in the working-plane system. Activate with SEL CORR-TABLE + FUNCTION CORRDATA; editable during program run
Freely definable tables*.TABYour own rows/columns (formats below) — the FN 26/27/28 and SQL playground
Text / mask files*.AASCII files; used as FN 16 format masks and free-form logs

FN 26/27/28 — Freely Definable Tables

Create a .TAB file in the file manager (the control offers templates; your own prototypes go in TNC:\system\proto), then shape it with the EDIT FORMAT soft key. Column types include TEXT, SIGN, DEC, INT, LENGTH (converted in inch programs), FEED, FLOAT, BOOL, TSTAMP, UPTEXT, PATHNAME. Table and column names must start with a letter and contain no arithmetic operators (SQL chokes on them). Text-type columns can only be read/written via QS parameters.

56 FN 26: TABOPEN TNC:\DIR1\TAB1.TAB        ; open (only one table open at a time)

53 Q5 = 3.75
54 Q6 = -5
55 Q7 = 7.5
56 FN 27: TABWRITE 5/"RADIUS,DEPTH,D" = Q5  ; write Q5,Q6,Q7 to row 5 - values
; must sit in CONSECUTIVE Q numbers

56 FN 28: TABREAD Q10 = 6/"X,Y,D"           ; row 6 -> Q10, Q11, Q12
57 FN 28: TABREAD QS1 = 6/"DOC"             ; text column -> QS parameter

Gotchas: FN 27 only actually writes in the Program Run modes (query the mode with FN 18 ID992 NR16 if a macro must know); a new FN 26 block silently closes the previous table; writing to a locked or nonexistent cell raises an error.

SQL Statements

For anything beyond single cells, the control has an SQL server — and HEIDENHAIN explicitly recommends SQL over FN 26–28 for speed. Programming SQL requires code number 555343. All SQL access is always metric, regardless of table or program units — convert before positioning with a read value in an inch program. Everything runs as a transaction: bind, select, fetch/update/insert, then commit or roll back — every transaction must be concluded, even read-only ones.

CommandPurpose
SQL BIND Q881 "Tab.Col"Bind a Q/QS parameter to a table column (empty BIND cancels)
SQL Q5 "SELECT … FROM … WHERE …"Open a transaction; returns a HANDLE in Q5 (0 = failed). Supports WHERE (==, <, >=, IS NULL, AND/OR, Q parameters as :'Q11'), ORDER BY … ASC/DESC, FOR UPDATE (row locking)
SQL FETCH Q1 HANDLE Q5 INDEX+Q2Copy one result-set row into the bound parameters (result 0 = OK, 1 = fault)
SQL UPDATE / SQL INSERTOverwrite a row / append a row from the bound parameters
SQL COMMIT / SQL ROLLBACKWrite everything back and close, or discard; both release locks and the handle
SQL SELECT Q5 "SELECT Col FROM … WHERE …"One-shot single-value read — no transaction, no binding
SQL EXECUTE instructionsCREATE SYNONYM, CREATE TABLE, COPY/RENAME/DROP TABLE, INSERT/UPDATE/DELETE rows, ALTER TABLE ADD/DROP, RENAME COLUMN

The manual’s complete read example — pull a material name out of WMAT.TAB:

0 BEGIN PGM SQL_READ_WMAT MM
1 SQL Q1800 "CREATE SYNONYM my_table FOR 'TNC:\table\WMAT.TAB'"
2 SQL BIND QS1800 "my_table.WMAT"          ; bind QS parameter to column
3 SQL QL1 "SELECT WMAT FROM my_table WHERE NO==3"
4 SQL FETCH Q1900 HANDLE QL1               ; QS1800 now holds the material
5 SQL ROLLBACK Q1900 HANDLE QL1            ; conclude the (read) transaction
6 SQL BIND QS1800                          ; remove binding
7 SQL Q1 "DROP SYNONYM my_table"
8 END PGM SQL_READ_WMAT MM

TABDATA — The Active Tool & Compensation Tables

The TABDATA functions are the ergonomic path to the tables that are currently active: read-only on the tool table *.t, read/write on activated *.tco/*.wco compensation tables. Unlike FN 18 and SQL, TABDATA converts units to match the NC program. Writes only take effect during program run — not in simulation or block scan.

12 SEL CORR-TABLE TCS "TNC:\table\corr.tco"           ; activate the table
13 TABDATA READ Q1 = CORR-TCS COLUMN "DR" KEY "5"     ; row 5, column DR -> Q1
14 TABDATA WRITE CORR-TCS COLUMN "DR" KEY "3" = Q1    ; Q1 -> row 3
15 TABDATA ADD   CORR-TCS COLUMN "DR" KEY "3" = Q1    ; add Q1 to row 3

Typical use: a touch-probe cycle measures wear, the program pushes the correction into the active compensation table with TABDATA WRITE, and FUNCTION CORRDATA re-activates the row.

FN 18: SYSREAD — System Data

One function reads everything the control knows, addressed as group ID + number NR + optional index IDX. Results are always metric. For values that need real time (positions!), stop the look-ahead first with FN 20: WAIT FOR SYNC.

32 FN 20: WAIT FOR SYNC                      ; pause look-ahead
33 FN 18: SYSREAD Q1 = ID270 NR1 IDX1        ; current X position -> Q1
55 FN 18: SYSREAD Q25 = ID210 NR4 IDX3       ; active Z scaling factor -> Q25
IDGroupHighlights
Program & machine state
ID10Program informationNR3 active machining cycle, NR6 last touch-probe cycle, NR110/111 does file/directory QS(IDX) exist (path check before CALL SELECTED PGM)
ID20Machine statusNR1 active tool number, NR2 prepared tool, NR3 tool axis, NR4 programmed speed, NR5 spindle state, NR8 coolant, NR9 active feed rate
ID35Modal statusNR1 absolute/incremental, NR2 radius compensation (0=R0, 1=RR/RL, 10/11 face/peripheral)
ID992Block scan / modeNR14 error number programmed in FN 14, NR16 operating mode the program runs in
Tools
ID50Tool table dataNR1 length L, NR2 radius R, NR3 R2, NR4 DL, NR5 DR… IDX = tool number, IDX0 = active tool
ID51Pocket table dataPocket assignment of a tool
Coordinates & presets
ID210Coordinate transformationsNR1 basic rotation (manual), NR2 programmed rotation, NR3 mirror axes, NR4 scaling per axis, NR5 3D-ROT, NR8 tilt-definition type
ID220Current datum shiftNR2 shift per axis (IDX 1–9 = X…W)
ID230Traverse rangeNR2/NR3 negative/positive software limits per axis
ID270Current positionNR1 nominal position in the input system, IDX = axis
ID500 / ID507 / ID508Datum / preset tableRead and write datum-table cells, preset basic transformation, preset axis offsets (row + column addressed)
ID530Active presetNR1 number of the active preset row
Probes & time
ID350Touch-probe dataTS: NR50–NR57 (type, length, radius, offsets, feeds, DIST, SET_UP); TT: NR70+ (center, radius, feeds)
ID360Probing resultsLast manual-cycle preset / touch point in input, machine, or workpiece coordinates; NR11 probing error status
ID310 / ID320System timeSeconds since 01.01.1970; format helpers for date/time strings

String-typed system data (program paths, tool name, pallet name, SW version, formatted date/time) come from the parallel SYSSTR( ID… NR… ) function into QS parameters.

FN 16: F-PRINT — Formatted Output

FN 16 merges a mask file (a .A text file defining the layout) with live Q-parameter values and sends the result to a file, the screen, a printer, or a network path. Output files are capped at 20 KB; repeated output to the same file appends unless the mask says otherwise. The log-file extension picks the output type (.TXT, .A, .XLS, .HTML).

Mask syntaxMeaning
"…", ;, ,Quoted format text; ; ends the block, , separates format from parameter list
%9.3FQ/QL/QR as decimal: 9 characters total, 3 decimals (+ right-aligns, - left-aligns)
%S / %RSQS string, formatted / raw (use %RS for paths so specials aren’t parsed)
%D / %IInteger
M_CLOSE / M_APPEND / M_APPEND_MAX20 / M_TRUNCATEClose file / append on re-output / append up to 20 KB / overwrite on re-output
M_EMPTY_HIDE / M_EMPTY_SHOWSuppress / restore empty lines for undefined QS parameters
CALL_PATH, HOUR MIN SEC DAY MONTH STR_MONTH YEAR2 YEAR4NC program path; real-time clock fields
L_ENGLISHL_ALLOutput a line only in that conversational language (or always)
; Mask file TNC:\MASKE\MASKE1.A
"MEASURING LOG OF IMPELLER CENTER OF GRAVITY";
"DATE: %02d.%02d.%04d",DAY,MONTH,YEAR4;
"TIME: %02d:%02d:%02d",HOUR,MIN,SEC;
"X1 = %9.3F", Q31;
"Y1 = %9.3F", Q32;
"Z1 = %9.3F", Q33;

; In the NC program:
96 FN 16: F-PRINT TNC:\MASKE\MASKE1.A / TNC:\PROT1.TXT   ; to a file
11 FN 16: F-PRINT TNC:\MASKE\MASKE1.A / SCREEN:          ; pop-up on screen
96 FN 16: F-PRINT / SCLR:                                ; clear the pop-up
96 FN 16: F-PRINT TNC:\MSK\MSK1.A / PC325:\LOG\PRO1.TXT  ; to a network drive

Source and target can also be QS parameters (:'QS1' syntax). A default output directory can be set in machine parameter fn16DefaultPath (no. 102202) — a path given in the FN 16 block wins. Printing (PRINTER:\ target) requires the mask to end with M_CLOSE.

FN 19 / 29 / 37 / 38 — PLC & Outbound Data

FN 19: PLC hands two values to the PLC, FN 29: PLC up to eight — both are builder territory, wrapped in collision warnings; use only in consultation with the machine manufacturer. FN 37: EXPORT exposes local Q/QS parameters back to a calling program — needed when you package your own cycles. FN 38: SEND writes text plus up to seven variable values to the log or over TCP/IP to an external application such as StateMonitor (job start/stop, part counts):

FN 38: SEND /"Q-Parameter Q1: %f Q23: %f" / +Q1 / +Q23
FN 38: SEND /"JOB:1234_STEP:1_OK_I:1"      ; report one good part to StateMonitor

Choosing the Right Mechanism

NeedUseUnits
Read/write your own .TAB, simpleFN 26/27/28Table units (LENGTH columns convert)
Multi-row/column work, any table, DDLSQLAlways metric
Active tool / compensation tableTABDATA READ/WRITE/ADDConverted to program units
Live control state, tool data, presetsFN 18 SYSREAD (+ FN 20 SYNC)Always metric
Reports, operator pop-upsFN 16 F-PRINTAs formatted

References

  • HEIDENHAIN, TNC 620 Klartext Programming User’s Manual, NC software 81760x-16, 01/2022, ID 1096883-29 (FN functions, SQL, TABDATA, FN 18 list).
  • HEIDENHAIN, TNC 620 User’s Manual for Setup, Testing and Running NC Programs, NC software 81760x-18, 10/2023, ID 1263172-25 (tool, pocket, preset, and touch-probe tables).

Have a question or want to contribute?

Contact us with corrections, additions, or topics you'd like covered.

Get in Touch