1214 HEIDENHAIN Technical Manual iTNC 530 HSCI
Access to data from 
the NC program
The NC blocks DATA ACCESS READ and DATA ACCESS WRITE enable you 
to access specific NC or PLC data from within the NC program. The same 
interface is used as for data access with Python. The subscription to and 
unsubscription from data take place automatically. The access rights are 
determined by the location where the executing NC program is stored (TNC:\, 
PLC:\). 
Example:
0  BEGIN PGM DATA_RW MM 
1  ;Read tool name of T2 from TOOL.T
2  DATA READ QS8 = "\TABLE\TOOL\T\2\NAME"
3  ;Tool radius of T2 from TOOL.T
4  DATA READ Q8 = "\TABLE\TOOL\T\2\R"
5  ;Write tool name of T5 in TOOL.T
6  DATA WRITE "\TABLE\TOOL\T\5\NAME" = QS8
7  ;Write tool radius of T5 in TOOL.T
8  DATA WRITE "\TABLE\TOOL\T\5\R" = Q8
9  ;Coordinate from line 5 of the KINEMAT0.TAB
10 DATA READ QL1 = "\TABLE\'TNC:\KINEMAT0.TAB'\NR\5\COORD"
11 ;File name from line 1 of the KINEMAT0.TAB
12 DATA READ QS15 = "\TABLE\'TNC:\KINEMAT0.TAB'\NR\1\FILE"
13 ;Write coordinate to line 7 of the KINEMAT0.TAB
14 DATA WRITE "\TABLE\'TNC:\KINEMAT0.TAB'\NR\7\COORD" = QL1
15 ;Write file name to line 2 of the KINEMAT0.TAB
16 DATA WRITE "\TABLE\'TNC:\KINEMAT0.TAB'\NR\2\FILE" = QS15
17 ;Read PLC word 4000
18 DATA READ QR1 = "\PLC\memory\W\4000"
19 ;Write to PLC word 4002
20 DATA WRITE "\PLC\memory\W\4002" = QR1
21 END PGM DATA_RW MM
Canceling an 
NC program
An NC macro can be called automatically if an NC program was canceled by 
an error message or an external or internal stop. You can use it to exchange 
information between the NC and the PLC. This NC macro may not contain any 
positioning commands, or the error message Program data erroneous will 
appear.
 In NCMACRO.SYS enter the name (and path) of the NC macro after the 
code word RUNCANCEL =.