Hi Lloyd,
here is my version as promised to you in private email.
If anyone uses this code to control machinery they do so at their own risk, I strongly recommend a hard wired power switch.
'************************************************* *****************
'* Name : Saw.BAS ***
'* Author : [Joe Stokes] ***
'* Notice : Copyright (c) 2006 Joe Stokes ***
'* : All Rights Reserved ***
'* Date : 9/9/06 ***
'* Version : 1.0 ***
'* Notes :This program delays vacuum, lights and power feed ***
'* :For a wood working tool. ***
'* :You may use this code for your personal devices ***
'* :without assigning any liability to me, and for non ***
'* :commercial purposes only. I recommend a positive ***
'* :mechanical power interrupting device for safety! ***
'* :Power tools are dangerous, and may inflict grave ***
'* :injury and or death. Your safety is your personal ***
'* :responsibility. Please enjoy the use of this code. ***
'* :It is my gift to you. ***
'************************************************* *****************
start:
' Change as applicable to your needs - a faster osc may make saw off happen even
' faster, certainly be worth a try. There are ports left over for ???
@ DEVICE pic16F84A, XT_OSC
@ DEVICE pic16F84A, WDT_OFF
@ DEVICE pic16F84A, PWRT_OFF
@ DEVICE pic16F84A, PROTECT_OFF
DEFINE OSC 4
PORTA = %00000001
PORTB = %00000000
TRISA = %00000000
TRISB = %00000000
symbol Power = PortA.0
symbol Saw = PortB.0
symbol Light = PortB.1
symbol Vacuum = PortB.2
symbol Feed = PortB.3
symbol Radio = PortB.4
symbol Sign = PortB.5
Flash var byte
main:
loop: if portA.0 = 0 then 'Switch is off - stop motors if running keep off if off.
gosub sub1
else
if portA.0 = 1 then ' Switch is On
gosub sub2 ' Begin power on sequence
else
goto loop ' endlessly check for power on condition
endif
endif
sub1: ' This routine stops the motors, lights and returns power
' to the shop's radio.
low Saw ' Turn Off SAW immediately
low Feed ' Turn Off power feed too
pause 5000 ' Five seconds for vacuum to remove dust from saw internals
low saw
low Light ' Turn Off Light
low Vacuum ' Turn Off Vacuum
high Radio ' Turn radio back on
low Sign ' Turn off Danger sign
goto loop ' Check for a power on request.
sub2:
for Flash = 5 to 0 step -1 ' Change the 5 to any # of flashes you like!
High Sign ' Turn on Danger Sign reminds family not to distract you!
pause 250 ' For Next loop flashes sign prior to saw starting
low Sign
pause 250
next
goto sub3 ' This is how I stopped the flashing light!
sub3: high sign ' Sign goes on continuously
low Radio ' Turn off radio, no distractions while cutting.
if portA.0 = 0 then
gosub sub1 'check off switch for off request
else
high Saw ' Turn On SAW, shaper, other power tool.
if portA.0 = 0 then
gosub sub1 ' Check off switch for off request
else
pause 1000 ' Time for saw to get up to speed and mains to settle down
if portA.0 = 0 then
gosub sub1 ' Check off switch for off request during delay.
else
pause 1000 ' Total 2 seconds delay for mains to settle.
high Vacuum ' Turn On Vacuum
if portA.0 = 0 then
gosub sub1 ' Check off switch for off request, keeping it safe
else
pause 1000 ' Time for vacuum motor to speed up and mains to settle
high Light ' Turn On Light
' Time for light to to come up to heat and mains to settle
if portA.0 = 0 then
gosub sub1 ' Check off switch for off request, still keeping safe.
else
pause 500
high Feed ' Turn On Power Feed, time to do some work!
endif
endif
endif
endif
endif
goto sub3 ' Loop back to sub3 where off command is located.
end ' I gotta keep the compiler happy!
Bookmarks