G20 & G21 (Unit Selection Codes)

Search This Blog

Monday, December 01, 2014

G20 & G21 (Unit Selection Codes)

G-Code G20 & G21 (Unit Selection Codes):

The CNC Programming can be done either with Imperial Unit (Inches G20) or The Metric Unit (Millimeter G21). The following items are also changed depending on whether G20 or G21 in the programs. 1) Positioning command values (X, Y and Z). 2) Incremental movement distances. 3) Feed rates commanded by the F code. 4) Offset values. In the world the US, Canada region are particularly use in inches, and other part of the world used Millimeter and some parts they use both inches and Millimeter depending on their requirements. Lowest input value in G20 (Inch) is 0.0001 inch and the Lowest input value in G21 (Millimetre) 0.001 mm, this give an advantage for G21 for more accuracy.

NOTE: G20 and G21 are the modal G-codes, so G20 can only be cancelled by G21 and vice versa.

NOTE: Units have to be defined in the beginning of the program or else Machine considers the default set by previous programs.

NOTE: Units cannot be reversed by changing only G20 or G21 in your program. It has to be defined before Post processing the program.

Example G20 Inch programming selection:

N170 O1000 N171 T02 M06 N172 G20 N173 G94 G54 G00 X10 Y10 Z100

G21 metric programming selection:

N170 O1000 N171 T02 M06 N172 G21 N173 G94 G54 G00 X10 Y10 Z100

3 comments:

  1. harshalJuly 11, 2018 8:10 pm

    This comment has been removed by the author.

    ReplyDeleteReplies
      Reply
  2. harshalJuly 11, 2018 8:12 pm

    visit www.hdknowledge.com

    ReplyDeleteReplies
      Reply
  3. Gennki GroupSeptember 14, 2020 3:56 pm

    Good post. I was searched this topic. Finally I got the information in this blog. Thanks for posting such a nice article. CNC milling

    ReplyDeleteReplies
      Reply
Add commentLoad more... Newer Post Older Post Home Subscribe to: Post Comments (Atom)

Total Pageviews

Blog Archive

  • ▼  2014 (25)
    • ▼  December (7)
      • G90 and G91 Positioning gcodes
      • G52 Offset Local Coordinate System
      • G50 and G51 Scaling and Mirroring
      • G43 G44 and G49 tool length compensation
      • G40 G41 and G42 Cuttercompensation
      • G28 Return Home
      • G20 & G21 (Unit Selection Codes)

Từ khóa » G20 Y G21 Cnc