Bird
Raised Fist0
CNC Programmingscripting~10 mins

Program number and sequence numbers in CNC Programming - Step-by-Step Execution

Choose your learning style10 modes available
Concept Flow - Program number and sequence numbers
Start Program
↓
Program Number: N100
↓
Sequence 1: N100 G01 X10 Y10
↓
Sequence 2: N110 G01 X20 Y20
↓
Sequence 3: N120 G01 X30 Y30
↓
End Program: M30
The CNC program starts with a program number, followed by sequence lines each with a sequence number, and ends with a program stop command.
Execution Sample
CNC Programming
N100 G01 X10 Y10
N110 G01 X20 Y20
N120 G01 X30 Y30
M30
This CNC program moves the tool to three positions in sequence and then ends.
Execution Table
StepLineProgram NumberSequence NumberCommandAction
1N100 G01 X10 Y10100100G01 X10 Y10Move tool to X10 Y10
2N110 G01 X20 Y20100110G01 X20 Y20Move tool to X20 Y20
3N120 G01 X30 Y30100120G01 X30 Y30Move tool to X30 Y30
4M30100M30End program
💡 Program ends at M30 command.
Variable Tracker
VariableStartAfter Step 1After Step 2After Step 3Final
Program NumberNone100100100100
Sequence NumberNone100110120120
Tool PositionUnknown(X10, Y10)(X20, Y20)(X30, Y30)(X30, Y30)
Program StateNot startedRunningRunningRunningEnded
Key Moments - 3 Insights
Why does the program number stay the same across sequence lines?
The program number identifies the whole program and stays constant; sequence numbers change to order commands within the program, as shown in execution_table rows 1 to 3.
What happens if a sequence number is skipped or repeated?
Skipping or repeating sequence numbers can confuse the CNC controller's order of execution. Sequence numbers should increase logically, as seen in execution_table steps 1 to 3.
Why is the M30 command not given a sequence number?
M30 is a program stop command and usually does not have a sequence number; it signals the program end, as shown in execution_table step 4.
Visual Quiz - 3 Questions
Test your understanding
Look at the execution table, what is the sequence number at step 2?
A100
B110
C120
DNone
💡 Hint
Check the 'Sequence Number' column in execution_table row 2.
At which step does the program end?
AStep 4
BStep 2
CStep 3
DStep 1
💡 Hint
Look for the M30 command in the 'Line' column in execution_table.
If the sequence number in step 3 was changed to N110, what would happen?
AProgram number would change
BProgram would run normally
CSequence numbers would repeat, causing confusion
DTool position would reset
💡 Hint
Refer to key_moments about sequence number repetition causing confusion.
Concept Snapshot
Program number (Nxxx) identifies the CNC program.
Sequence numbers (Nxxx) order commands inside the program.
Commands like G01 move the tool.
M30 ends the program.
Sequence numbers should increase logically.
Program number stays constant throughout.
Full Transcript
This lesson shows how a CNC program uses a program number and sequence numbers. The program starts with a program number, for example N100. Each line has a sequence number like N100, N110, N120 to order the commands. Commands like G01 move the tool to positions X10 Y10, X20 Y20, and X30 Y30 in order. The program ends with M30. The program number stays the same for all lines. Sequence numbers increase to keep commands in order. Repeating or skipping sequence numbers can cause confusion. The M30 command ends the program and usually has no sequence number. This helps CNC machines run the program step by step correctly.

Practice

(1/5)
1. What is the main purpose of a program number in CNC programming?
easy
A. To identify the entire CNC job uniquely
B. To order commands inside the program
C. To set the speed of the machine
D. To define tool sizes

Solution

  1. Step 1: Understand program number role

    The program number is used to identify the whole CNC job uniquely so the machine knows which program to run.
  2. Step 2: Differentiate from sequence numbers

    Sequence numbers order commands inside the program, not identify the program itself.
  3. Final Answer:

    To identify the entire CNC job uniquely -> Option A
  4. Quick Check:

    Program number = unique job ID [OK]
Hint: Program number names the job; sequence numbers order steps [OK]
Common Mistakes:
  • Confusing program number with sequence number
  • Thinking program number sets machine speed
  • Assuming program number defines tool sizes
2. Which of the following is the correct syntax for a program number in CNC code?
easy
A. N100 G01 X10 Y10
B. M30
C. G90 G40
D. O1234

Solution

  1. Step 1: Identify program number syntax

    Program numbers usually start with 'O' followed by digits, e.g., O1234.
  2. Step 2: Check other options

    N100 is a sequence number, M30 is program end, G90 G40 are modal commands.
  3. Final Answer:

    O1234 -> Option D
  4. Quick Check:

    Program number starts with 'O' [OK]
Hint: Program number starts with 'O' followed by digits [OK]
Common Mistakes:
  • Using N for program number instead of sequence number
  • Confusing M codes with program number
  • Mixing G codes with program number
3. Given the CNC code snippet:
O5000
N10 G00 X0 Y0
N20 G01 X10 Y10
N30 M30

What is the sequence number of the command that moves the tool to X10 Y10?
medium
A. N10
B. N20
C. N30
D. O5000

Solution

  1. Step 1: Locate the command moving tool to X10 Y10

    The line N20 G01 X10 Y10 moves the tool to X10 Y10.
  2. Step 2: Identify its sequence number

    The sequence number is the number after 'N', which is N20.
  3. Final Answer:

    N20 -> Option B
  4. Quick Check:

    Move to X10 Y10 = N20 [OK]
Hint: Sequence numbers start with N before commands [OK]
Common Mistakes:
  • Confusing program number O5000 with sequence number
  • Picking N10 which moves to X0 Y0
  • Choosing N30 which ends the program
4. Identify the error in this CNC program snippet:
O1000
N10 G00 X0 Y0
N10 G01 X10 Y10
N30 M30
medium
A. Duplicate sequence numbers N10
B. Missing program number
C. Incorrect use of M30
D. No error

Solution

  1. Step 1: Check sequence numbers for duplicates

    Sequence numbers N10 appear twice, which can confuse the CNC controller.
  2. Step 2: Verify other elements

    Program number O1000 is present, M30 is correctly used to end the program.
  3. Final Answer:

    Duplicate sequence numbers N10 -> Option A
  4. Quick Check:

    Sequence numbers must be unique [OK]
Hint: Sequence numbers must be unique and increasing [OK]
Common Mistakes:
  • Ignoring duplicate sequence numbers
  • Thinking M30 is wrong here
  • Assuming program number is missing
5. You want to create a CNC program with program number 2500 and sequence numbers starting at 5, increasing by 5 for each command. Which of the following is the correct start of the program?
hard
A. O2500 N5 G00 X0 Y0 N7 G01 X10 Y10
B. O2500 N5 G00 X0 Y0 N15 G01 X10 Y10
C. O2500 N5 G00 X0 Y0 N10 G01 X10 Y10
D. O2500 N1 G00 X0 Y0 N6 G01 X10 Y10

Solution

  1. Step 1: Confirm program number syntax

    Program number must start with 'O' followed by 2500: O2500.
  2. Step 2: Check sequence numbers increment

    Sequence numbers start at 5 and increase by 5: 5, 10, 15, ... O2500 N5 G00 X0 Y0 N15 G01 X10 Y10 has N5 then N15, which skips N10, so incorrect. O2500 N5 G00 X0 Y0 N10 G01 X10 Y10 has N5 then N10 (increment 5), O2500 N5 G00 X0 Y0 N15 G01 X10 Y10 has N5 then N15 (increment 10), O2500 N5 G00 X0 Y0 N7 G01 X10 Y10 increments by 2, O2500 N1 G00 X0 Y0 N6 G01 X10 Y10 starts at 1.
  3. Step 3: Re-examine options

    O2500 N5 G00 X0 Y0 N10 G01 X10 Y10 has correct increments (5, 10), O2500 N5 G00 X0 Y0 N15 G01 X10 Y10 increments by 10 (5 to 15), O2500 N5 G00 X0 Y0 N7 G01 X10 Y10 increments by 2 (5 to 7), O2500 N1 G00 X0 Y0 N6 G01 X10 Y10 starts at 1.
  4. Final Answer:

    O2500 N5 G00 X0 Y0 N10 G01 X10 Y10 -> Option C
  5. Quick Check:

    Sequence numbers increase by 5 starting at 5 [OK]
Hint: Sequence numbers must increase by 5 starting at 5 [OK]
Common Mistakes:
  • Skipping correct sequence increments
  • Starting sequence numbers at wrong value
  • Confusing program number syntax
Recommended

Ready to prove it?

Pass the test and this pattern moves unknown strong while earning +1 Grip toward your certificate.

10 questions~5 mineasy hard