Production with CNC machine tools requires a large quantity of measurement data and parameters to guarantee the quality and verify the production in accordance with the legal requirements. In order to prevent the loss of machining parameters during the production process, the "WRITE" high-level language element can be used to archive the machining parameters, for example, to safeguard the production. The archiving is performed through the automatic creation of a log file in the NC of the machine.
The task of the "WRITE" high-level language element is to write blocks or data from NC programs to a log file. This is used, for example, to safeguard the production or for logging the measurement data. During the currently running NC program, the "WRITE" high-level language element reads out the specified data and writes it automatically to the log file of the machine NC. If a log file does not exist, it is generated in MPF format. An existing log file is automatically appended during the program execution. The created files are freely accessible and can be read, changed and deleted by all users of the machine.
The WRITE command is structured in accordance with the following template:
DEF INT <error> WRITE(<error>,“<file name>“,“<block/data>“)
WRITE Command for appending a block or data to the end of a specified file.
Variable for returning the error value.
The name of the file in the passive file system in which the specified block or specified data is to be added.
The block or data to be added to the specified file.
Setpoint and actual value of a single-point measurement (CYCLE978) in the current example are read from the existing NC-program and a "PROTOKOLL.MPF" log file is written.
DEF INT _ERROR G17 G54 G90 T="3D_TASTER" M6 G0 X23 Y0 G0 Z5 CYCLE978(100,10008,,1,0,20,5,3,2,1,"",,0,1.01,1.01,-1.01,0.34,1,0,,1,1) WRITE(_ERROR,"_N_LOG","SETPOINT Z="<<_OVR) WRITE(_ERROR,"_N_LOG","ACTUAL VALUE Z="<<_OVR) WRITE(_ERROR,"_N_LOG","DIFFERENCE="<<_OVR) M30
Explanation of the programming example
Definition of error variables
G17 G54 G90
Selecting the probe
Loading the 3D probe
G0 X23 Y0G0 Z5
Starting point of the measurement
Writing of the setpoint in the log file
WRITE(_ERROR,"_N_LOG","ACTUAL VALUE Z="<<_OVR)
Writing of the actual value in the log file
Writing of the difference between the actual value and setpoint in the log file
Offset vector I1$TC_CARR3[n], Z component
Rotary axis vector V1$TC_CARR7[n], X component
Offset vector I14$TC_CARR19[n], Y component
End of program
After "Selection" and processing of the sequential program by pressing the "CYCLE START" button, the log file (PROTOKOLL.MPF) was created automatically in the same folder. The log file has the following content:
SETPOINT Z=0 ACTUAL VALUE Z=0.01300811768 DIFFERENCE=0.01300811768
The programms and the documentation are available at the Siemens Support-Portal: