SINUMERIK 840C: Resolving Block Search Counter Errors

David Krause2 min read
Other TopicSiemensTechnical Reference
Licensed PE Working through this on a live machine? A Maine-licensed engineer can take it from here — included with IMD hardware, by the hour for everything else. Book an engineer

A part counter such as R731=R731+1 must not execute while the CNC reconstructs program state during block search. The same protection can prevent increments during dry/test execution and simulation. The evidence confirms the SINUMERIK 840C method in an actual block-search test; the supplied 840D method remains a proposed implementation that requires machine verification.

Failure mode and required behavior

Without a mode check, restarting with block search can execute the counter assignment and advance the engraved serial or part quantity without producing another part. Place the mode-dependent branch immediately before the counter assignment and put the destination label immediately after every line that must be skipped.

Control Modes covered by supplied logic Evidence status
SINUMERIK 840C Block search and test run Reported as successfully tested during block search
SINUMERIK 840D Block search, dry run, and simulation Proposed but not subsequently tested in the evidence

Configure the SINUMERIK 840C guard

The @371 statements read operating-mode state into temporary R parameters. In the supplied explanation, the first constant selects channel 0; the second value identifies block search as 0, test run as 1, or simulation as 2. A K with no explicit number represents constant 0.

@371 R98 K K
@371 R99 K K1
R99=R99+R98
125 R99 K1 K0020
N0010 R731=R731+1
N0020

This implementation combines the block-search and test-run results in R99. The supplied conditional branch skips to N0020 when the protected mode is active, bypassing the increment at N0010. Although mode value 2 was identified as simulation, the tested snippet does not read that state; do not claim simulation protection for this version.

Apply the proposed SINUMERIK 840D guard

The 840D proposal evaluates the documented program-state variables supplied in the evidence and branches forward over the counter assignment when any selected mode is active.

IF ($P_SEARCH) OR ($P_DRYRUN) OR ($P_SIM) GOTOF WEITER
R731=R731+1
WEITER:

$P_SEARCH, $P_DRYRUN, and $P_SIM correspond respectively to block search, dry run, and simulation in the supplied logic. Because the evidence contains no completed 840D test, validate this code on the target control before relying on it for production numbering.

Verify counter protection

  1. Record the current value of R731 before initiating the non-production mode.
  2. Run block search to a destination after the protected assignment. On 840C, confirm execution branches to N0020; on 840D, confirm it reaches WEITER:.
  3. Verify that R731 did not change. Then perform one normal production execution and verify that it increments once.
  4. Repeat the check for each mode covered by the selected guard: test run on 840C, and dry run and simulation on 840D. Treat the 840D result as machine-specific validation because it was not confirmed in the evidence.

FAQ

How do I stop R731 incrementing during SINUMERIK 840C block search?

Read block-search and test-run state with the supplied @371 statements, combine the results in R99, and use 125 R99 K1 K0020 to branch around R731=R731+1. The evidence reports successful 840C block-search testing.

What do K, K1, and K2 mean in the 840C @371 mode check?

In the supplied explanation, an unnumbered K is constant 0. For the second mode argument, 0 identifies block search, 1 test run, and 2 simulation.

How do I bypass a part counter during SINUMERIK 840D search and simulation?

Use IF ($P_SEARCH) OR ($P_DRYRUN) OR ($P_SIM) GOTOF WEITER before the increment and place WEITER: after it. This 840D pattern was proposed in the evidence but not confirmed by a reported test, so verify that the counter remains unchanged in every selected mode.

Back to blog