G-code reference

G22 G-Code: Stored Stroke Check On

Stored Stroke Check On — Enables a programmable forbidden zone (stored stroke limit 2). If the tool tries to enter the area defined by the two corner points, the control stops with an…

By cnccode · Updated
PropertyValue
CodeG22
FunctionStored Stroke Check On
Modal group04
TypeModal — stays active until replaced by another code of the same group
Used onMills and lathes
SyntaxG22 X_ Y_ Z_ I_ J_ K_

What does G22 do?

Enables a programmable forbidden zone (stored stroke limit 2). If the tool tries to enter the area defined by the two corner points, the control stops with an alarm. It protects chucks, tailstocks and fixtures.

G22 is modal: once programmed it remains in effect for the following blocks until another code from modal group 04 replaces it or the control is reset.

Syntax and parameters

Format
G22 X_ Y_ Z_ I_ J_ K_
AddressMeaning
X Y ZOne corner of the zone (machine coordinates)
I J KOpposite corner

G22 example program

Example
G22 X-200.0 Z-150.0 I-100.0 K-50.0
(program)
G23

▶ Open this example in the G-code viewer

Tips and common mistakes

  • Whether the inside or outside of the zone is forbidden depends on a parameter.

Controller compatibility

G22 follows the ISO/Fanuc dialect used by Fanuc, Haas, Brother, Doosan, Hurco (ISO mode), Mazak (EIA/ISO mode), Okuma (G-code mode) and Siemens in ISO dialect mode. Parameters, option packages and builder-specific behaviour can differ, so confirm the details in your machine's programming manual before running a new program.

Frequently asked questions

Is G22 modal?
Yes. G22 belongs to modal group 04 and stays active until another code of that group is programmed.
What does G22 mean in CNC?
G22 means Stored Stroke Check On. Enables a programmable forbidden zone (stored stroke limit 2). If the tool tries to enter the area defined by the two corner points, the control stops with an alarm. It protects chucks, tailstocks and fixtures.
What is the difference between G22 and G23?
G22 is Stored Stroke Check On, while G23 is Stored Stroke Check Off. See the G23 page for its syntax and examples.
Can I use G22 on a lathe?
Yes, G22 is used on both mills and lathes, although some parameters differ between them.