4.5 Creating and Writing Programs
Organization of an NC program in HEIDENHAIN conversational format.
A part program consists of a series of program blocks. The figure at right illustrates the elements of a block.
The TNC numbers the blocks in ascending sequence.
The first block of a program is identified by BEGIN PGM, the program name and the active unit of measure.
The subsequent blocks contain information on:
nThe workpiece blank nTool definitions, tool calls
nFeed rates and spindle speeds, as well as nPath contours, cycles and other functions
The last block of a program is identified by END PGM, the program name and the active unit of measure.
Defining the blank form–
BLK FORMImmediately after initiating a new program, you define a cuboid workpiece blank. If you wish to define the blank at a later stage, press the BLK FORM soft key. This definition is needed for the TNC’s graphic simulation feature. The sides of the workpiece blank lie parallel to the X, Y and Z axes and can be up to 100 000 mm long. The blank form is defined by two of its corner points:
nMIN point: the smallest X, Y and Z coordinates of the blank form, entered as absolute values.
nMAX point: the largest X, Y and Z coordinates of the blank form, entered as absolute or incremental values.
10 L X+10 Y+5 R0 F100 M3
Block number
Path function Words
Blocks
You only need to define the blank form if you wish to run a graphic test for the program!
64 4 Programming: Fundamentals of NC, File Management, Programming Aids, Pallet Management
4.5 Cr eating and W riting Pr ogr a ms
Creating a new part program
You always enter a part program in the Programming and Editing mode of operation. Program initiation in an example:
Select the Programming and Editing mode of operation.
To call the file manager, press the PGM MGT key.
Select the directory in which you wish to store the new program
Enter the new program name and confirm your entry with the ENT key.
To select the unit of measure, press the MM or INCH soft key. The TNC switches the screen layout and initiates the dialog for defining the BLK-FORM.
Enter the spindle axis.
Enter in sequence the X, Y and Z coordinates of the MIN point.
Enter in sequence the X, Y and Z coordinates of the MAX point.
File name = OLD.H
Working spindle axis X/Y/Z ?
Def BLK FORM: Min-corner ?
Def BLK FORM: MAX-corner ? 0
0 -40
100 100 0
4.5 Cr eating and W riting Pr ogr a ms
Example: Display the BLK form in the NC program.
The TNC automatically generates the block numbers as well as the BEGIN and END blocks.
0 BEGIN PGM NEW MM Program begin, name, unit of measure
1 BLK FORM 0.1 Z X+0 Y+0 Z-40 Spindle axis, MIN point coordinates
2 BLK FORM 0.2 X+100 Y+100 Z+0 MAX point coordinates
3 END PGM NEW MM Program end, name, unit of measure
If you do not wish to define a blank form, cancel the dialog at Working spindle axis X/Y/Z by pressing the DEL key!
The TNC can display the graphic only if the ratio of the short side to the long sides of the BLK FORM is greater than 1:64!
66 4 Programming: Fundamentals of NC, File Management, Programming Aids, Pallet Management
4.5 Cr eating and W riting Pr ogr a ms
Programming tool movements in conversational format
To program a block, initiate the dialog by pressing a function key. In the screen headline, the TNC then asks you for all the information necessary to program the desired function.
Example of a dialog
Dialog initiation
Enter the target coordinate for the X axis.
Enter the target coordinate for the Y axis, and go to the next question with ENT.
Enter “No radius compensation” and go to the next question with ENT.
Enter a feed rate of 100 mm/min for this path contour;
go to the next question with ENT.
Enter the miscellaneous function M3 “spindle ON”;
pressing the ENT key will terminate this dialog.
The program blocks window will display the following line:
Coordinates ?
Radius comp. RL/RR/no comp. ?
Feed rate F=? / F MAX = ENT
Miscellaneous function M ?
3 L X+10 Y+5 R0 F100 M3
Functions for setting the feed rate Soft key Rapid traverse
Traverse feed rate automatically calculated in TOOL CALL
10
20
100
3
4.5 Cr eating and W riting Pr ogr a ms
Editing a program
While you are creating or editing a part program, you can select any desired line in the program or individual words in a block with the arrow keys or the soft keys:
Function Key
Ignore the dialog question
End the dialog immediately
Abort the dialog and erase the block
Function Soft keys/keys
Go to the previous page
Go to the next page
Go to beginning of program
Go to end of program
Move from one block to the next
Select individual words in a block
Function Key
Set the selected word to zero
Erase an incorrect number
68 4 Programming: Fundamentals of NC, File Management, Programming Aids, Pallet Management
4.5 Cr eating and W riting Pr ogr a ms
Inserting blocks at any desired location
777
7Select the block after which you want to insert a new block and initiate the dialog.
Editing and inserting words
777
7Select a word in a block and overwrite it with the new one. The plain-language dialog is available while the word is highlighted.
7 77
7To accept the change, press the END key.
If you want to insert a word, press the horizontal arrow key repeatedly until the desired dialog appears. You can then enter the desired value.
Looking for the same words in different blocks Set the AUTO DRAW soft key to OFF.
To select a word in a block, press the arrow keys repeatedly until the highlight is on the desired word.
Select a block with the arrow keys.
The word that is highlighted in the new block is the same as the one you selected previously.
Finding any text
777
7To select the search function, press the FIND soft key. The TNC displays the dialog prompt Find text:
7 77
7Enter the text that you wish to find.
777
7To find the text, press the EXECUTE soft key.
Erase cycles and program sections: First select the last block of the cycle or program section to be erased, then erase with the DEL key.
Function Key
4.5 Cr eating and W riting Pr ogr a ms
Marking, copying, deleting and inserting program sections The TNC provides certain functions for copying program sections within an NC program or into another NC program—see the table at right.
To copy a program section, proceed as follows:
7 7 7
7Select the soft-key row using the marking function.
7 7 7
7Select the first (last) block of the section you wish to copy.
77
77To mark the first (last) block: Press the SELECT BLOCK soft key. The TNC then highlights the first character of the block and
superimposes the soft key CANCEL SELECTION.
7 7 7
7Move the highlight to the last (first) block of the program section you wish to copy or delete. The TNC shows the marked blocks in a different color. You can end the marking function at any time by pressing the CANCEL SELECTION soft key.
7 7 7
7To copy the selected program section: Press the COPY BLOCK soft key, and to delete the selected section: Press the DELETE BLOCK soft key. The TNC stores the selected block.
7 7 7
7Using the arrow keys, select the block after which you wish to insert the copied (deleted) program section.
7 7 7
7To insert the block: Press the INSERT BLOCK soft key.
To insert the section into another program, select the corresponding program using the File Manager and then mark the block after which you wish to insert the copied block.
Function Soft key
Switch on marking function
Switch off marking function
Delete marked block
Insert block that is stored in the buffer memory
70 4 Programming: Fundamentals of NC, File Management, Programming Aids, Pallet Management