Writing messages into a file

With the command #MSG SAVE data are saved directly out of the NC program in a file on a storage media (e.g. hard disk). The possibilities for the structuring of a message text and for the output of data are identical to the commands #MSG or #MSG INFO.

#MSG SAVE [EXCLUSIVE] ["<message_text>"]

The programming of a mode (SYN) or of a receiver ID (e.g. HMI) is not necessary and causes an error, because the message is written into the report file directly after evaluation in NC program.

The message text must be enclosed in quotation marks "...". For each call of #MSG SAVE the message text is added to the file end, if the file already exists. To create a new report file, before NC program start the user should delete an already existing file.

With #MSG SAVE ["message text "] in the report file the message text is stored in the form

< time stamp > “message text“

With #MSG SAVE EXCLUSIVE ["message text "] in the report file the message text is stored without time stamp in the form

“message text“

The name of the report file can be defined before with the command #FILENAME. If this command is not used, #MSG SAVE writes into a file with the default name message.txt.

The path for the report file can be defined in the start-up list [7]-2. If no path for the report file is entered, dependend on the control platform a default path is used respectively the report file is stored in the main directory of the control.

Programming example

: 
#FILENAME [MSG="timer.txt"]
:
#TIMER START [ID=10] Start counter 10
#TIMER START SYN [ID11] Start counter 11 (IPO-level)
:
:
#TIMER READ [ID10] Save counter value in V.G.TIMER[10]
#TIMER READ SYN [ID11] Save counter value in V.G.TIMER[11]
#MSG SAVE["T10= %d",V.G.TIMER[10]] Store counter value in timer.txt
#MSG SAVE["T11= %d",V.G.TIMER[11]] Store counter value in timer.txt
#TIMER STOP [ID10] Counter 10 is stopped.
#TIMER CLEAR [ID10] Reset counter 10.
: