JDB(中国电子)官方网站_JDB





      JDB(中国电子)官方网站_JDB

      Position:Home>Solutions> HNC21 M P

      HNC21 macro programming

      Outline

      HNC -21M NC system equips powerful macro function similar with high language. Consumer can use variable to do arithmetic operation, logical operation and functional hybrid operation. Moreover, macro provides loop statement, branch statement and subprogram calling statement to make program editing of complex components easy, and reduce , even avoid, cockamamie numerical evalsuation.

      1. Macro variables and constant

      (1) Macro variables

      #0~#49 current local variable

      #50 ~ #199 global variable

      #200 ~ #249 0 layer local variable

      #250 ~ #299 1 layer local variable

      #300 ~ #349 2 layer local variable

      #350 ~ #399 3 layer local variable

      #400 ~ #449 4 layer local variable

      #450 ~ #499 5 layer local variable

      #500 ~ #549 6 layer local variable

      #550 ~ #599 7 layer local variable

      #600 ~ #699 register of tool length H0 ~ H99

      #700 ~ #799 register of tool radius D0 ~ D99

      #800 ~ #899 register of cutting life

      (2) Constant

      PI: π

      TRUE : condition true (T)

      FALSE : condition false (F)

      2. Operator and expression

      (1) Arithmetical operator : + , - , * , /

      (2) Conditional operator

      EQ(=),NE(≠),GT(>),

      GE(≥),LT(<),LE(≤)

      (3) Logical operator

      AND,OR,NOT

      (4) Function

      SIN,COS,TAN,ATAN,ATAN2,

      ABS,INT,SIGN,SQRT,EXP

      (5) Expression

      Constant s and macro variables linked by operators compose expression.

      For example : 175/SQRT[2] * COS[55 * PI/180 ] ;

      #3*6 GT 14;

      3. Assignment statement

      Format : macro variables = constant or expression

      Sending values of constant or expression to a macro variable is called assignment .

      For example : #2 = 175/SQRT[2] * COS[55 * PI/180 ] ;

      #3 = 124.0;

       

      Conditional judgment statement IF , ELSE , ENDIF

      Format (i) : IF conditional expression

      ELSE

      ENDIF

      Format (ii) : IF conditional expression

      ENDIF

      4. Loop statement WHILE , ENDW

      Format : WIIILE conditional expression

      ENDW

      Using of conditional judgment statement see also example of macro programming

      Using of loop statement see also example of macro programming

      5. Example JDB(中国电子)官方网站_JDB
      Tool Path:
      JDB(中国电子)官方网站_JDB
      Program code:

      %0010

      #10=10.0

      #11=10.0

      #12=124.0

      #13=124.0

      #101=8.0

      #102=6.5

      #103=6.0

      N01 G92 X0.0 Y0.0 Z10.0

      #0=0

      N06 G00 X[-#12] Y[-#13]

      N07 G01 Z[-#10] M03 S600 F200

      WHILE #0 LT 3

      N[08+#0*6] G01 G42 X[-#12/2] Y[-90/2] F280.0 D[#0+50]

      N[09+#0*6] X[0] Y[-90/2]

      N[10+#0*6] G03 J[90/2]

      N[11+#0*6] G01 X[#12/2] Y[-90/2]

      N[12+#0*6] G40 X[#12] Y[-#13]

      N[13+#0*6] G00 X[-#12] Y[-#13]

      #0=#0+1

      ENDW

      N100 Z[-#10-#11]

      #2=90/SQRT[2]*COS[55*PI/180]

      #3=90/SQRT[2]*SIN[55*PI/180]

      #4=90*COS[10*PI/180]

      #5=90*SIN[10*PI/180]

      #0=0

      WHILE #0 LT 3

      N[101+#0*8]G01 G42 X[-#12/2] Y[-90/2] F280.0 D[#0+50]

      N[102+#0*8]X[-#2] Y[-#3]

      N[103+#0*8]G91 X[+#4] Y[+#5]

      N[104+#0*8]X[-#5] Y[+#4]

      N[105+#0*8]X[-#4] Y[-#5]

      N[106+#0*8]X[+#5] Y[-#4]

      N[107+#0*8] G90 X[#12/2] Y[-90/2]

      N[108+#0*8]G00 G40 X[-#12] Y[-#13]

      #0=#0+1

      ENDW

      G00 X0 Y0 M05 M30

      JDB(中国电子)官方网站_JDB

      JDB(中国电子)官方网站_JDB