User Manual of Macro V2.0
User Manual of Macro V2.0
V2.0
Chapter 1 MACRO
1
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
2
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
Chapter 2 M MACRO
3
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
4
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
E.g.2: When macro variable #313 is 1(non-0) , pop up dialog and exit.
IF(+#313)THEN
MESSAGEBOX(ERROR: COOLANT PUMP IS OVERLOAD!)
RETURN
ENDIF
5
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
2.2.11 Return
Format: RETURN
When macro program is processed succefully,and use this code to exit macro
program and return back.
6
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
Chapter 3 G MACRO
7
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
2. <A expression> after THEN must exist, otherwise system will hint grammatical errors.
8
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
Prolongation:
3) IF(conditional express)
<A operational command>
ELSE
<B operational command>
ENDIF
4) IF(conditional express)
<A operational command>
ELIF
<B operational command>
ENDIF
segments ,which is between Do n & END n. Otherwise system will enter endless loop.
2.Nesting of macro program loop statements of SZGH CNC system is 3 pcs of loops at
9
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
G00 X100
WHILE (#150 EQ 5)DO 2
G00 Y100
WHILE (#200 GE 20)DO 3
G00 Z100
#200=#200-2
END 3
#150=#150-1
END 2
#100=#100-1
END 1
10
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
Chapter 4 Variable
11
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
#2018: Use electric gear of spindle position feedback (0: no , Non-0: yes)
#2019: Control mode of spindle (G74/G84/G33 thread & spindle orientation)
#2020: Managment way of tool(0: use M06, Non-0: use T code directly)
#2021: Way of selecting tool(0: single direction, Non-0: both direction random)
#2022: Way of feeding axes return to reference point
#2023: Max length of detecting zero position when homing
#2024: Max no. of tool case in fixed tool area
#2025: Reference point of Z-axis return when changing tool
#2026: Stoping degreen when spindle orientation during tool change
#2027: Control mode when spindle homing
#2028: Power condition of each axis when booting
#2029: Max speed when Z-axis using handwheel (mm/min)
#2030: Max speed when X/Y/A-axis using handwheel (mm/min)
#2031: Detect SP_orientation & Point of changing point before change tool(Non-0:
yes , 0: No)
#2046: stoping degree of spindle orientation when boring canned cycle
#2047: Homing Speed of spindle
#2048: Speed of spindle orientation
#2049: Allow Error Range of spindle orientation
#2050: Way of tool radius C compensation set up
#2051: Way of tool radius C compensation cancel
#2052: Position direction when SP-orientation adopt pulse interpolation control way
#2053: Delay time when spindle change direction suddenly (unit: 0.1s)
#2054: Acceleration of spindle servo ((mm/min)/s)
#2055: Active function of tool change
#2056: Transmission bits when communicate with RS232 serial port
#2057: Delay time between driver off of power & reboot (unit: 0.1s)
#2058: Interlock between motion of Z-axis and spindle take tool(0: No , Non-0:Yes)
#2059: Shifting distance after X-axis homing (unit:0.1mm)
#2060: Shifting distance after Y-axis homing (unit:0.1mm)
17
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
18
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
2. When first word is “ / ” is someone line, which means that the line is for explanation
3. All dialog box of macro variable are edited on files of “interfacecn.cfg” &
“interfaceeg.cfg” .
19
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
Size & Position of Dialog:datunm point is based on point of upper left corner ,
Unit: Pixels. (Displayer is 800*600 pixels)
20
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
Left: L1~Ln: 2nd data, start from datumn point, left to left side of dialog box ;
Top: T1~Tn: 3rd data, start from datumn point, down to top side of dialog box;
Width: W1~Wn: 4th data, width of dialog box
Height: T1~Tn: 5th data, heigh of dialog box
(4) If 1st data is “0”,which means configuration of dialog box, and we could set
position & size of dialog box of macro varible;5th data can be omitted;
If 1st data is “1”,which means configuration of static text, normally used as prompt
informations, 5th data display the prompt information;
If 1st data is “2”,which means configuration of pressing button, 5th data is for
displaying prompt messages of button;
If 1st data is “3”,which means configuration of edit box , also used for assingment
of macro variable, 5th data is for specify macro variable; 6th data is used for specify
type of this macro variable, “I” means intege type, no specify means floating-point
type;
If 1st data is “4”,which means configuration of picture, 5th data is the name of
picture ,
Name of Picture: fillpict1, fillpict2, fillpict3 ...
Format of Picture: 16-color (4 bits) or 256-color(8bits) or 16bits or 24 bits BMP
type formatted image
Note: Please try to use 4bits or 6bits pictures to save occupied memory of picture.
22
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
23
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
#50=#5023;
MOVE(G90,F#383,Z#388,W+25);//#1925
PAUS160;
IF (-X25) THEN
MESSAGEBOX(Error: Cannot detect signal of tool setting gauge!)
ERREXIT;
ENDIF
MOVE(G90,F#384,Z#1929,W-25);
IF (+X25) THEN
MESSAGEBOX(Error:Cannot off of signal of tool setting gauge!)
ERREXIT;
ENDIF
#51=#385+#389;
SETWK(Z#51);
MOVE(G90,F#386,Z#50);
MESSAGEBOX(Tool Setting Automatically Succefully!!)
RETURN;
(2) M882
STATUSINFO(Auto Set Drop Value of Z-axis of Tool Setting );
IF (+#387) THEN;
MOVE(G90,F#386,Z#382);
MOVE(G90,F#386,X#380,Y#381);
ENDIF;
MOVE(G90,F#383,Z#388,W+25);//#1925
PAUS160;
IF (-X25) THEN
MESSAGEBOX(Error:Cannot detect signal of tool setting gauge!)
ERREXIT;
ENDIF
24
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
MOVE(G90,F#384,Z#1929,W-25);
IF (+X25) THEN
MESSAGEBOX(Error:Cannot off of signal of tool setting gauge!)
ERREXIT;
ENDIF
#50=#5023;
MESSAGEBOX(Move Tool Tip to Surface of Workpiece & Run M883 code!)
RETURN;
(3) M883
#389=#50-#5023;
MESSAGEBOX(Drop of Z-axis Set Well for setting tool!)
RETURN;
25
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
26
-Shenzhen Guanhong Automation Co.,Ltd.- Macro of CNC System
#96=#16
#97=#17
#98=#18
#99=#19
#100=#20
#30=#4003
#31=#4014
G90
IF[#30 EQ 90] GOTO 1
G53
#98=#5001+#98
#99=#5002+#99
N1 WHILE[#86 GT 0] DO 1
#35=#98+#87*COS[#80]
#36=#99+#87*SIN[#80]
G81X#35Y#36Z#100R#92F#85
#80=#80+#81
#86=#86-1
END 1
G#30 G#31 G80
M99
27