Branching with IF/GOTO

Take different actions from a measurement using IF[…]GOTO and sequence labels.

The OSP makes decisions with IF [condition] GOTO Nxx, jumping to a line tagged with that sequence number. Comparisons are words: EQ NE GT GE LT LE. A plain GOTO N90 jumps unconditionally — you'll use one to skip past the branches you didn't take.

Read firstOkuma Alarms & ParametersGuide to Okuma OSP alarms and parameters: the A/B/C/D alarm level system, what stops at each level, raising stops from a program, the NC/user/optional parameter landscape, and OSP diagnostic screens.

Your turn

A measured bore diameter is in VC1; the target is 25.0 mm. Grade the part into VC9: over 25.05 is oversize, set VC9 = 2; under 24.95 is undersize, set VC9 = 0; anything in between is good, set VC9 = 1. Use IF[…]GOTO.

The machine gives you

25.00 — dead on, good:VC1 = 25
25.10 — oversize:VC1 = 25.1
24.90 — undersize:VC1 = 24.9

Your program is run once for each set of conditions. It has to work for all of them.

Loading...

This is a learning simulation — always prove out a program on the actual control before you cut metal.