1. ## Sleep/Timer Commands

Hi,
I'm running a 3-axis milling machine on Camsoft and I'm looking for a way to turn the lubracation of the axis ON and OFF in order to save oil. As an exemple, while a program is running, I'd like to turn on the lubrication for 1 minute, then OFF for 3 minutes, and so on.

I've noticed that the SLEEP command seems to paralyse the entire machine for the time it's... sleeping. Using the TIMER command, it seems that I can turn the pump either ON or OFF... but not the two alternately.

How can I manage the axis lubrication according to a certain period of time?

2. SLEEP doesn't apply in your situation. You need code in the timer.fil. RUNTIME is a command that puts how long you've been running into a variable. Do some math to divide this by 4 minutes and look at the remainder. Then use an IF THEN statement to turn on your output during the portion of your 4 minute cycle you'd like.

karl

P.S. If you want to run the oiler only when running a program, take a look at LOADING. It will have a value of 2 when in cyclestart mode.

3. Another option would be to put in a external (hardwired) timer relay and run the coil for the relay from a Camsoft output.

AL

4. Phil,

The simplest method is to set your the TIMER ON logic command to set the millisecond time interval 60000 for 1 minute for the lube I/O and use a variable counter to toggle back and forth between on and off

Select an un-used variable for this:

In the TIMER.FIL file write:

\333={\333+1}
IF \333<4 THEN #7=0 ' I/O for Lube OFF
IF \333=4 THEN #7=1:\333=0 ' I/O for Lube ON

Alternative:

Or else you could always replace SLEEP with the IF THEN GOTO and TIME commands in a loop until the time elapses with the need for the TIMER.FIL file.

In the Macro.Mac Library you can modify this macro which is checking for time elapsed into a routine that uses the TIME to do the lube.

[TIMED IO CHECK]
' The following routine checks to see if a prox switch is hit within 500 ms if not then display a message
' Change time 500 ms and I/O relay # as needed
#83=1 ' Engage air cylinder to move
TIME RESETMS ' set millisecond time counter to zero
LOOP:
TIME MS;\55 ' read how many milliseconds has elapsed
IF \55>500 THEN LABEL1 AIR TOO LOW;12:EXIT
IF #59=0 THEN GOTO :LOOP ' if switch not hit then re-check again
' If made it here then switch was hit within 500 ms

5. I'll be more elegant. The above macro runs all the time unless you get tricky with turning TIMER on and off. Also you have to run TIMER at that interval. So my solution (in timer.fil):

RUNTIME \901
\902={\901/4-INT(\901/4)}
IF\900=2THENIF\902<.25THEN#7=1:GOTO:OILEREND
#7=0
:OILEREND

Put this command in startup.ini

TIMER ON 1000 'can be any other interval if needed

Karl