What controller is this program for?
Where I worked before we had a start-up macro that checked the "front panel" overrides, coolants, etc. before starting. I can't seem to find it. Does anyone know what I'm talking about? It was on a new lathe, and I believe Okuma actually wrote it. Also, I have a 3000 control manual, if anyone wants it.
Thanks,
GP
What controller is this program for?
OSP7000
Okuma has the only macro language that easily allows you to check the status of switches on the operator panel and the state of things like the chuck and the tailstock. These macros will show you how easy it is to take advantage of this power.
Keyboard Macro for Okuma OSP5000 Controls
Checking the State of Cycle Start and Chuck Open on OSP Controls
Verifying the Second Offset of a Grooving Tool on an OSP Control
A Macro to Prepare Bar Stock
Dual Saddle No Crash Header - Submitted by Chris Piegeler
Keyboard Macro for Okuma OSP5000 controls (9/24/97)
Okuma allows you to read the state of various switches on the operator keyboard including Spindle Override, Feed Rate Override, Dry Run, Single Block, Auto Coolant and Optional Stop. You can take advantage of this to write a macro that checks the state of the keyboard when Cycle Start is pressed. I use this to make sure that the operator hasn't accidentally turned Dry Run on or forgotten to turn the coolant back on. If Single block is ON, the macro exits without checking the switches. Use the Check Data key on the control to see these inputs. Look under EC Panel Input for bits to change while you move the switches.
To use the macro, paste this code into an editor and then send it to your OSP5000 control. It will be saved as O.SSB which is a System Sub Routine. To edit the macro on the control you will have to enter O.SSB instead of using edit *. To call the macro, insert CALL OALM in your machining program before each tool.
$O.SSB
OALM
N1 IF[[VDIN[1128] AND 2] EQ 2] NEND(MACHINE LOCK)
N2 IF[[VDIN[1138] AND 32] EQ 32] NALA7 (LOAD AUTO SET)
N3 IF[[VDIN[1128] AND 1] EQ 1] NALA1 (DRY RUN ON)
N4 IF[[VDIN[1128] AND 128] EQ 128] NEND (SINGLE BLOCK ON)
N5 IF[[VDIN[1132] AND 2] EQ 2] NALA2 (FEED RATE OVER)
N6 IF[[VDIN[1132] AND 8] NE 8] NALA2 (FEED RATE OVER)
N7 IF[[VDIN[1132] AND 1] EQ 1] NALA2 (FEED RATE OVER)
N8 IF[[VDIN[1132] AND 4] EQ 4] NALA2 (FEED RATE OVER)
N9 IF[[VDIN[1132] AND 16] NE 16] NALA3 (SPINDLE OVER)
N10IF[[VDIN[1132] AND 32] EQ 32] NALA3 (SPINDLE OVER)
N11IF[[VDIN[1132] AND 64] NE 64] NALA3 (SPINDLE OVER)
N12IF[[VDIN[1132] AND 128] EQ 128] NALA3 (SPINDLE OVER)
N13IF[[VDIN[1126] AND 128] NE 128] NALA5 (AUTO COOLANT)
GOTO NEND
NALA1 VUACM[1]='DRY RUN IS ON'
VDOUT[993]=1000
NALA2 VUACM[1]='FEED RATE NE 100'
VDOUT[993]=1000
NALA3 VUACM[1]='SPINDLE OVERRIDE'
VDOUT[993]=1000
NALA4 VUACM[1]='LOAD MONITOR'
VDOUT[993]=1000
NALA5 VUACM[1]='COOLANT NOT ON'
VDOUT[993]=1000
NALA7 VUACM[1]='LOAD AUTO SET'
VDOUT[993]=1000
NEND RTS
%
Note: For OSP5020 controls change line N5 to read
N5 IF[[VDIN[1132] AND 2] NE 2] NALA2 (FEED RATE OVER)
Okuma changed the state of the bit on the OSP 5020 for some reason.
If you don't understand how to use the AND function in this example, IF[[VDIN[1132] AND 2] EQ 2] NALA2 (FEED RATE OVER), then you need to purchase our Macro Programming Manual.
Return to Top of Page
Checking the State of Cycle Start and Chuck Open (9/24/97)
Have you ever used M00 somewhere in a program to allow the operator to remove chips or inspect the part only to have him put the next part in and crash the machine? This macro will prevent that from happening. Instead of using an M00, the macro creates an indefinite loop that continues until Cycle Start is pressed or the chuck is opened.
If Cycle Start is pressed the program jumps to N5 (or any line number you want) and continues. However, if the chuck is opened, because the operator forgot that he was at M00 and put a new part in, the program jumps to an alarm code and tells the operator to restart.
NLOOP IF[[VDIN[1124] AND 2] EQ 2]N5
IF[[VDIN[1108] AND 2] EQ 2]NALA1
GOTO NLOOP
N5G0X20Z20(NEXT TOOL IN PROGRAM)
...PROGRAM CODE
...PROGRAM CODE
...
GOTO N9999
NALA1 VUACM[1]='RESTART FROM N5'
VDOUT[991]=999
N9999 M02
To use the macro, insert it where you would normally have an M00. The lines
NLOOP IF[[VDIN[1124] AND 2] EQ 2]N5
IF[[VDIN[1108] AND 2] EQ 2]NALA1
GOTO NLOOP
do the actual work. IF[[VDIN[1124] AND 2] EQ 2] is true if Cycle Start is pressed and then execution jumps to line N5. Otherwise, IF[[VDIN[1108] AND 2] EQ 2]NALA1 checks to see if the Chuck open switch has been pressed. If so, execution jumps to the alarm. Be sure to put the alarm at the end of the program. You can use the Check Data key on the control to see the input for Chuck Open. Look under EC Panel Input for bits to change while you activate the chuck pedal.
Return to Top of Page
Verifying the Second Offset of a Grooving tool on an OSP Control (11/25/97)
Have you ever wanted to use two offsets for a grooving tool or turning tool but were afraid the operator would forget to set the second offset and crash the machine? Or worse, you did program for a second offset and the machine did get crashed. This macro shows how to read the offset of each tool and determine if the second tool is set correctly.
Notice that Okuma allows variables to have alphanumeric names. In this example, IDOF is set to the X offset of tool 7 and DOF is set to the X offset of tool 17. The variable names are arbitrary. The statement VTOFZ[17]=VTOFZ[7] sets the Z offset of tool 17 equal to the Z offset of tool 7. This is done because we are allowing for a small adjustment in the X axis but Z should be the same so this eliminates one more error source for the operator.
The statement IF[DIF LT .015] NEND compares the X offset of tool 7 to tool 17 and exits if the difference is less than .015". In this example, the machining program was written on a CAM system that compensated for the width of the grooving too. That's why the difference between offsets is set at .015. If you don't compensate for the width of the tool in the machining program you will have to add the width of the tool to the .015. This makes the code less generic because you have to change it for each different width of insert but it still works.
You can also use the same concept for turning tools and boring bars. For example, if a part has a close diameter with a relief in the middle you might want to have two offsets to compensate for taper in the machine. Use this type of macro to be sure the operator doesn't forget to set the second offset.
(FACE GROOVE TOOL)
(SET THE TOOL OFF OF THE O.D.)
(OFFSET #7 WILL CONTROL THE HUB DIA.)
(OFFSET #17 WILL CONTROL THE ID)
G14
IDOF=VTOFX[7]
DOF=VTOFX[17]
VTOFZ[17]=VTOFZ[7]
DIF=ABS[IDOF-DOF]
IF[DIF LT .015] NEND
NALA1 VUACM[1]='GRV TOOL NOT SET'
VDOUT[992]=999
NEND
Return to Top of Page
A Macro to Prepare Bar Stock (12/5/98)
This macro program is used to prepare bar stock. By prepare I mean face and turn a true diameter on the end of the stock and possibly drill a hole in the center. This is useful if you are using hot rolled, spun cast or other material that isn't very round to begin with. This program allows the operator to enter a few variables and then prepare the stock.
The program uses a variable as a Flag or switch to determine if the part should be drilled or not. In this case V32 is used as the flag. When set to zero the program ends without drilling, when set to one the program drills a hole to the required depth. The following variables are used:
V10 is the diameter of the bar stock. .25 is added to this diameter when positioning for facing in case the part is running out.
V11 is the tool number for facing/turning the part.
V12 is the finish diameter for the prepping operation. Since a roughing cycle is used the part can be considerably oversize. This is very convenient if the correct bar stock size isn't available.
V13 is the depth to turn the part. Z0 is the face of the part.
V29 is the tool number for the drilling operation.
V30 is the RPM for the drilling operation.
V31 is the to drill. Don't forget to account for the drill point length.
V32 is the flag for drill. Setting V32 to zero skips the drilling operation, set to one drills.
$BAR_PREP.MIN%
(PROGRAM TO PREP BAR STOCK)
(V10 IS DIAMETER OF BAR STOCK)
(V11 IS THE TOOL NUMBER)
(V12 IS DIAMETER TO TURN STOCK)
(V13 IS DEPTH TO TURN)
(V29 IS TOOL # OF DRILL)
(V30 IS SPEED TO DRILL)
(V31 IS DEPTH TO DRILL)
(V32=FLAG FOR DRILLING)
(0 IS NO DRILL 1 IS DRILL)
G50S1600
G0X20Z20M44
X=V10+.25Z1.T=V11G97S500M3
G0Z0G96S600M8
G1X-.04F.004
G1Z.05
G0X=V10
NTURN G81
G0X=V12-.15
G1Z0F.006
G76X=V12L-.06
G1Z=-V13
G1X=V10F.006
G40
G80
/G85 NTURN U.02 W.003 D.15 F.006
G87 NTURN
G0G97S500M9Z1.
G0X20Z20
M01
IF[V32 EQ 0]GOTO NEND
(DRILL)
N2G0X20Z30
G110
G0X0T=V29G97S500M3
G0Z1.0S=V30(500SFM 1.5)
G0Z.1M8
G74X0Z=-V31D1.L3.0F.004
G0Z1.M9S500
G0X20Z30
NEND
M02
G14
NEND
M02
%
Dual Saddle No Crash Header - Submitted by Chris Piegeler
Here is a little program header which I wrote to protect machine, tools and the operator. Itīs for two-saddled lathe machines (Okuma OSP 5000).
Some of the programs we use, use to have the rough cutting tool on one saddle and finishing tool on the other.
So when the operator had to restart one of those programs (for setting up the finishing tool, for instance), he blocked the "rough tool cutting saddle" and restarted on the other. Fine. But if he had forgotten to unblock the rough cutting revolver for the next work piece the finishing tool would crash into the untreated piece.
That's where this header comes in: It recognizes the single saddle mode and exits the program with a warning, if it wasn't called for a restart.
NX001 G13
NX002 V13=0
NX003 P2
NX004 P3
NX005 IF[VRSTT NE 0] GOTO NX009
NX006 IF[V13 EQ 1] GOTO NX009
NX007 VUACM[1]='B IS BLOCKED'
NX008 VDOUT[993]=999
NX009 V9=1
NX010 P4
NX011 G14
NX012 P2
NXD00 (DO NOT DELETE THESE DUMMY LINES)
NXD00 (DO NOT DELETE THESE DUMMY LINES)
NX013 V13=1 V9=0
NX014 P3
NX015 P4
NX016 IF[VRSTT NE 0] GOTO NX020
NX017 IF[V9 EQ 1] GOTO NX020
NX018 VUACM[1]='A IS BLOCKED'
NX019 VDOUT[993]=999
NX020
The header requires that the following program begins with a G13/G14 definition and that first following P-value has to be above 4. It uses two global Variables: V13 and V9.
The two "NXD00"-lines are dummy ones to bypass the cache (which would set the variables in the following lines though the prog should wait for a sync).
Some of our (OSP5000) machines do not handle the system variables ''VRSTT", "VUACM", "VDOUT", so that these lines have to be removed or modified.
I know that this header code could be more compressed but this version DOES work fine and I donīt want to publish an untested code.
>>>>>>>>>>>>>>>Enough for now - back to work<<<<<<<<<<<<<<<<<<
All great coding CNCBOY... but it will NOT work on the OSP7000 series controller.
Okuma changed the way that this stuff is checked on the 7000 series compared to the 5000 & 5020 series. (Change of board technology etc I believe...).
Not sure of the syntax but it is similar to the above approach.
Do a search of this forum, I think this has been covered elsewhere.
OCHEK (LB-1511 WITH -7000 C0NTROL 2-21-96)
IF [VIRD[MLCK]EQ 1] NRTS
IF [VIRD[DRYR]EQ 0] NCK1
VUACM[1]='DRY RUN ON'
VDOUT[993]=1
NCK1 IF[VIRD[BDE]EQ 0] NCK2
VUACM[1]='BLOCK DELETE ON'
VDOUT[993]=1
NCK2 IF[VIRD[LFO]LE 9] NCK3
VUACM[1]='FEEDRATE GT 100'
VDOUT[993]=1
NCK3 IF[VIRD[LSRO]EQ 4] NCK4
VUACM[1]='SPINDLE OVERIDE'
VDOUT[993]=1
NCK4 IF[VTRD[CLTP]EQ 1] NCK5
VUACM[1]='COOLANT OFF'
VDOUT[993]=1
NCK5 IF[VRSTT EQ 0] NRTS (IF RESTART)
NCK6 IF[VIRD[LFO]EQ 0] NCK7
VUACM[1]='FEEDRATE GT 0'
VDOUT[993]=1
NCK7 IF[VIRD[SGB]EQ 1] NRTS
VUACM[1]='SINGLE BLK OFF'
VDOUT[993]=1
NRTS RTS
>>>>>>>>>>>>>>>Enough for now - back to work<<<<<<<<<<<<<<<<<<