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 2628 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.

TableFileKey columns / notes
Tool data (edited via Tool management)
Tool tabletool.tT (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 toolstoolturn.trnOption #50 / #4-03-1
Grinding / dressing toolstoolgrind.grd / tooldress.drsOption #156 / #4-04-1
Touch probe tabletchprobe.tpProbing 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 tabletool_p.tchMagazine map: P pocket, T tool, RSV reserved, ST special tool, F fixed pocket, L locked pocket
Workpiece reference
Preset tablepreset.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*.dD 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*.tabYour 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*.pntNR, 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*.3DTCRadius deviation of ball-nose cutters vs. contact angle; must sit in TNC:\system\3D-ToolComp
Pallet table*.pJob lists / pallet machining
Cutting data*.cut / *.cutdCutting-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.

CommandFunction
SQL BINDLink a variable to a table column (empty BIND cancels the link)
SQL SELECTRead a single value — no transaction, no binding needed
SQL EXECUTEOpen a transaction with a SELECT query (also CREATE SYNONYM, CREATE TABLE…)
SQL FETCHTransfer a result-set row into the bound variables
SQL UPDATE / SQL INSERTChange an existing row / create a new row
SQL COMMIT / SQL ROLLBACKSave / 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
IDGroupUseful entries
Program & machine state
ID10Program informationNR3 last executed touch probe cycle; NR110/NR111 does file/directory QS(IDX) exist (guard SEL PGM calls)
ID15Indexed variable accessNR11/12/13 read Q(IDX) / QL(IDX) / QR(IDX)
ID20Machine statusNR1 active tool number, NR2 prepared tool, NR3 active tool axis (0=X 1=Y 2=Z), NR4 programmed spindle speed, NR5 spindle condition
ID320System timeNR1 seconds since 1970-01-01 UTC; NR3 processing time of the current NC program
ID920CountersNR1 planned workpieces, NR2 completed (see FUNCTION COUNT)
ID992Block scan / run modeNR10 block-scan info; NR14 FN 14 error number; NR16 is this run a simulation?
Positions & transformations
ID210Coordinate transformationsNR1 basic rotation (manual), NR2 programmed rotation, NR4 dimension factors (IDX = axis)
ID220Current datum shiftNR2 shift in mm, IDX 1–9 = X, Y, Z, A, B, C, U, V, W
ID240 / ID270Nominal position REF / input systemNR1, IDX = axis — current nominal position in machine (REF) or active (input) coordinates
Tool & probe data
ID200Tool compensationNR1 active radius (with/without oversize via IDX)
ID950Data of current toolNR1 length L, NR2 radius R, NR3 radius R2, NR4 oversize DL… mirrors the tool.t columns
ID360Probing resultsLast 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)
ID990Tool availabilityNR1 tool check; NR10 resolve a tool name in QS(IDX) to its number (see indexed-tool trick in probing cycles)
Tables
ID500Active datum tableRead/write values by row and column
ID507 / ID508Preset tableBasic transformation (NR 1–6) / axis offsets (NR 1–9) by row
ID510 / ID520Pallet / point tablePallet-row data; point-table values (NR1–3 = X/Y/Z)
ID530Active presetNR1 number of the active row in the active preset table
ID590Free memoryNR2/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 syntaxMeaning
"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_TRUNCATEClose file / append on re-output / append up to 20 kB / overwrite
M_EMPTY_HIDE / M_EMPTY_SHOWSuppress / restore blank lines for undefined QS parameters
HOUR MIN SEC DAY MONTH STR_MONTH YEAR2 YEAR4Timestamp 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 — Q100Q107 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