Heidenhain TNC7 Tables & System Data
Almost everything a TNC7 knows — tool geometry, presets, datums, probe settings — lives in tables, and Klartext gives you four distinct ways to reach them from a running program: TABDATA for the active tables, FN 26–28 for freely definable tables, SQL statements for everything at speed, and FN 18: SYSREAD for live system data. Add FN 16: F-PRINT for formatted output and you can build inspection reports and adaptive macros entirely on the control. Everything here is from the TNC7 81762x-20 (10/2025) manuals; the TNC7 basic and TNC7 go run the same software platform.
The TNC7 Table Landscape
Know the file extensions — the access functions identify tables by them. Standard tables live in TNC:\table.
| Table | File | Key columns / notes |
|---|---|---|
| Tool data (edited via Tool management) | ||
| Tool table | tool.t | T (number, index after decimal point), NAME, L, R, R2, delta values DL/DR (written automatically by touch probe cycles), plus wear/monitoring columns (CUT, LTOL, RTOL, TL…). Must be in TNC:\table. |
| Turning tools | toolturn.trn | Option #50 / #4-03-1 |
| Grinding / dressing tools | toolgrind.grd / tooldress.drs | Option #156 / #4-04-1 |
| Touch probe table | tchprobe.tp | Probing feed rate F, rapid FMAX, max measuring range DIST, set-up clearance SET_UP, center offsets CAL_OF1/CAL_OF2, orientation TRACK; linked to tool management via TP_NO |
| Pocket table | tool_p.tch | Magazine map: P pocket, T tool, RSV reserved, ST special tool, F fixed pocket, L locked pocket |
| Workpiece reference | ||
| Preset table | preset.pr (*.pr) | NO, X/Y/Z basic transformation, spatial angles SPA/SPB/SPC, axis offsets X_OFFS…; active row = workpiece preset / W-CS origin |
| Datum table | *.d | D row, X/Y/Z shift in W-CS, A/B/C/U/V/W offsets in M-CS; select with SEL TABLE, activate a row from the NC program |
| Program-facing tables | ||
| Freely definable table | *.tab | Your columns, your data (e.g. measurement results); read/write via FN 26–28 or SQL; column types TEXT, INT, LENGTH, FEED, FLOAT, BOOL, TSTAMP… |
| Point table | *.pnt | NR, X/Y/Z, FADE (hide point), CLEARANCE; cycle runs at each point (SEL PATTERN) |
| Compensation tables | *.tco / *.wco | *.tco compensates in the tool coordinate system (all technologies), *.wco in the working-plane coordinate system (mainly turning); select with SEL CORR-TABLE |
| 3D tool compensation | *.3DTC | Radius deviation of ball-nose cutters vs. contact angle; must sit in TNC:\system\3D-ToolComp |
| Pallet table | *.p | Job lists / pallet machining |
| Cutting data | *.cut / *.cutd | Cutting-data calculator source tables (diameter-independent / dependent) |
TABDATA — the Active Tables
TABDATA works on whichever table is currently active: tool table *.t (read-only), compensation tables *.tco/*.wco (read/write), preset table *.pr (read/write). Read access works anytime; write access only during program run — writes during simulation or a block scan have no effect. Unlike FN 18 or SQL, TABDATA converts values between mm and inch to match your NC program automatically.
11 TABDATA READ Q1 = CORR-TCS COLUMN "DR" KEY "5" ; Row 5, column DR of the comp table -> Q1
12 TABDATA WRITE CORR-TCS COLUMN "DR" KEY "3" = Q1 ; Q1 -> row 3, column DR
13 TABDATA ADD CORR-TCS COLUMN "DR" KEY "3" = Q1 ; Add Q1 to the existing value
Target selector is TOOL, CORR-TCS, CORR-WPL or PRESET; COLUMN takes a name (or QS), KEY the row. The classic use: write the compensation a touch probe cycle just measured into the compensation table (TABDATA WRITE) or update it after a repeat measurement (TABDATA ADD — the comp table must be activated with SEL CORR-TABLE first). Two warnings from the manual: writes overwrite existing values without any confirmation, and undefined preset-table fields behave differently from 0 — 0 overwrites the previous value on activation while an undefined field keeps it.
FN 26 / 27 / 28 — Freely Definable Tables
The traditional TNC trio: open, write, read. Only one table can be open at a time — a new FN 26 closes the previous one. One NC block addresses one row but may list several columns; multi-column values go into (or come from) consecutive variables.
11 FN 26: TABOPEN TNC:\table\TAB1.TAB ; Open the table
12 Q5 = 3.75 ; Value for the Radius column
13 Q6 = -5 ; Value for the Depth column
14 Q7 = 7.5 ; Value for the D column
15 FN 27: TABWRITE 5 / "Radius,Depth,D" = Q5 ; Write Q5, Q6, Q7 to row 5
21 FN 28: TABREAD Q10 = 6 / "X,Y,D" ; Row 6 -> Q10, Q11, Q12
22 FN 28: TABREAD QS1 = 6 / "DOC" ; Text column -> QS1
Numbers and texts can't be mixed in one multi-column write. FN 27 is live on active table rows and also runs during simulation — changing process-relevant data (tool, preset) from a simulated program is a real collision risk, so gate it (see the FN 18 ID992 trick below). Table and column names must start with a letter and contain no arithmetic operators, and column names are not case-sensitive.
SQL Statements
For heavy table work HEIDENHAIN explicitly recommends SQL over FN 26–28 — it uses the HDR disk speed and less computing power. Requires code number 555343. Access runs through a transaction model: bind variables to columns, select a result set (the handle lands in a Q parameter; 0 = invalid), fetch/update/insert rows, then commit or rollback. Every transaction you open must be concluded — even read-only ones — or locks and resources stay held.
| Command | Function |
|---|---|
SQL BIND | Link a variable to a table column (empty BIND cancels the link) |
SQL SELECT | Read a single value — no transaction, no binding needed |
SQL EXECUTE | Open a transaction with a SELECT query (also CREATE SYNONYM, CREATE TABLE…) |
SQL FETCH | Transfer a result-set row into the bound variables |
SQL UPDATE / SQL INSERT | Change an existing row / create a new row |
SQL COMMIT / SQL ROLLBACK | Save / discard all changes and conclude the transaction |
11 SQL BIND Q881 "Tab_Example.Position_Nr"
12 SQL BIND Q882 "Tab_Example.Measure_X"
13 SQL BIND Q883 "Tab_Example.Measure_Y"
14 SQL BIND Q884 "Tab_Example.Measure_Z"
...
20 SQL Q5 "SELECT Position_Nr,Measure_X,Measure_Y,Measure_Z FROM Tab_Example WHERE Position_Nr==:'Q11'"
11 SQL SELECT Q5 "SELECT Mess_X FROM Tab_Example WHERE Position_NR==3" ; One-shot read
Two gotchas from the manual: SQL reads and writes are always metric regardless of table or program units (convert before positioning in inch programs), and SQL commands execute during simulation too — skip them with a conditional, checking FN 18: SYSREAD ID992 NR16 to detect whether the program is running in simulation.
FN 18: SYSREAD — System Data
Reads numeric system data into a variable, addressed by group ID, number NR, and optional index IDX (plus a sub-index .DAT for tool data). Output is always metric regardless of program units (use TABDATA READ when you want automatic conversion from the tool table). The string twin SYSSTR is programmed identically and returns alphanumeric data. The complete list is its own document (ID 1445456-xx); these are the groups worth memorizing:
11 FN 18: SYSREAD Q25 = ID210 NR4 IDX3 ; Active dimension factor of the Z axis -> Q25
12 QS25 = SYSSTR( ID 10950 NR1 ) ; Current tool name -> QS25
| ID | Group | Useful entries |
|---|---|---|
| Program & machine state | ||
ID10 | Program information | NR3 last executed touch probe cycle; NR110/NR111 does file/directory QS(IDX) exist (guard SEL PGM calls) |
ID15 | Indexed variable access | NR11/12/13 read Q(IDX) / QL(IDX) / QR(IDX) |
ID20 | Machine status | NR1 active tool number, NR2 prepared tool, NR3 active tool axis (0=X 1=Y 2=Z), NR4 programmed spindle speed, NR5 spindle condition |
ID320 | System time | NR1 seconds since 1970-01-01 UTC; NR3 processing time of the current NC program |
ID920 | Counters | NR1 planned workpieces, NR2 completed (see FUNCTION COUNT) |
ID992 | Block scan / run mode | NR10 block-scan info; NR14 FN 14 error number; NR16 is this run a simulation? |
| Positions & transformations | ||
ID210 | Coordinate transformations | NR1 basic rotation (manual), NR2 programmed rotation, NR4 dimension factors (IDX = axis) |
ID220 | Current datum shift | NR2 shift in mm, IDX 1–9 = X, Y, Z, A, B, C, U, V, W |
ID240 / ID270 | Nominal position REF / input system | NR1, IDX = axis — current nominal position in machine (REF) or active (input) coordinates |
| Tool & probe data | ||
ID200 | Tool compensation | NR1 active radius (with/without oversize via IDX) |
ID950 | Data of current tool | NR1 length L, NR2 radius R, NR3 radius R2, NR4 oversize DL… mirrors the tool.t columns |
ID360 | Probing results | Last preset/touch point of a manual probe cycle or Cycle 0 (input, workpiece, or machine coordinates); NR10 oriented spindle stop; NR11 probing error status (0 OK, −1 not reached, −2 already deflected) |
ID990 | Tool availability | NR1 tool check; NR10 resolve a tool name in QS(IDX) to its number (see indexed-tool trick in probing cycles) |
| Tables | ||
ID500 | Active datum table | Read/write values by row and column |
ID507 / ID508 | Preset table | Basic transformation (NR 1–6) / axis offsets (NR 1–9) by row |
ID510 / ID520 | Pallet / point table | Pallet-row data; point-table values (NR1–3 = X/Y/Z) |
ID530 | Active preset | NR1 number of the active row in the active preset table |
ID590 | Free memory | NR2/NR3 IDX 1–30, freely usable values that survive program selection |
FN 16: F-PRINT — Formatted Output
The measuring-log workhorse. Two pieces: a format file (mask, extension *.a) that defines layout, and the FN 16 call that names mask + output target. Output lands in a file (extension decides the type — TXT, A, XLS, HTML), on screen (SCREEN: — also mirrored to the FN 16 tab of the Status workspace), on a USB/network drive, or on a printer (Printer:\ — mask must end with M_CLOSE). Max output file size 20 kB; the file is written at END PGM, NC STOP, or the M_CLOSE keyword.
; Format file TNC:\fn16.a
"TOUCHPROBE";
"%S",QS1;
M_EMPTY_HIDE;
"%S",QS2;
"%S",QS3;
M_EMPTY_SHOW;
"%S",QS4;
"DATE: %02d.%02d.%04d",DAY,MONTH,YEAR4;
"TIME: %02d:%02d",HOUR,MIN;
M_CLOSE;
; NC program
11 Q1 = 100
12 QS3 = "Pos 1: " || TOCHAR( DAT+Q1 )
13 FN 16: F-PRINT TNC:\fn16.a / SCREEN: ; Show the log in a window
14 FN 16: F-PRINT TNC:\MSK\MSK1.A / PC325:\LOG\PRO1.TXT ; Or write to a network drive
| Mask syntax | Meaning |
|---|---|
"9.3F",Q1; | Numeric output: 9 total digits, 3 decimals; types %F float, %D double, %I integer; %S string, %RS raw string (no formatting — use for paths) |
+ / - | Right- / left-align the value |
; and , | End of mask line / separator between format and variable |
* | Comment line (not output); %% literal percent, \\ backslash, \n line break, %" quotation mark |
M_CLOSE / M_APPEND / M_APPEND_MAX20 / M_TRUNCATE | Close file / append on re-output / append up to 20 kB / overwrite |
M_EMPTY_HIDE / M_EMPTY_SHOW | Suppress / restore blank lines for undefined QS parameters |
HOUR MIN SEC DAY MONTH STR_MONTH YEAR2 YEAR4 | Timestamp keywords; CALL_PATH = path of the calling NC program; L_ENGLISH… language-gated lines |
Variable paths use QS parameters in single quotes with a leading colon: FN 16: F-PRINT TNC:\mask.a / :'QS1'.txt. Machine parameters fn16DefaultPath/fn16DefaultPathSim (no. 102202/102203) set a default output folder; a path in the FN 16 call overrides them, and a bare file name drops the log next to the NC program. Repeated outputs to the same file append.
PLC Data — FN 19 / FN 29 / FN 37
The TNC7 still has FN 19: PLC, FN 20: WAIT FOR, FN 29: PLC, and FN 37: EXPORT, plus the newer READ FROM PLC / WRITE TO PLC functions — but they are locked behind code number 555343 and intended for HEIDENHAIN, the machine manufacturer, and third-party integrators only. The manual explicitly warns machine operators and NC programmers off them: they modify machine behavior under program control and can render the control inoperable. If you need PLC values in a normal program, read them the sanctioned way — Q100–Q107 carry values from the PLC. For pushing data out, use FN 38: SEND (log/StateMonitor via TCP/IP), which is not restricted.
References
- HEIDENHAIN, TNC7 User's Manual — Programming and Testing, NC software 81762x-20, 10/2025, ID 1358773-24 (tables, TABDATA, FN 16/18/26–28, SQL).
- HEIDENHAIN, TNC7 User's Manual — Setup and Program Run, 10/2025, ID 1358774-24 (tool.t, tool_p.tch, tchprobe.tp, preset.pr).
- HEIDENHAIN, TNC7 series — Overview of the Machine Parameters, Error Numbers and System Data, 10/2025, ID 1445456-xx (full FN 18 / SYSSTR list).
Have a question or want to contribute?
Contact us with corrections, additions, or topics you'd like covered.
Get in Touch