I'd trust a PIC- the real question is would you trust the code. A big red mechanical 'kill-power' button in series with the saw wouldn't be a bad idea.Originally Posted by Joe S.
I'd trust a PIC- the real question is would you trust the code. A big red mechanical 'kill-power' button in series with the saw wouldn't be a bad idea.Originally Posted by Joe S.
It is not the pic or code per-se' I don't trust, it's power surges, stray capacitance, you name it . . . gremlins, I'm just saying when my fingers are near the moving parts, I want the isolation of an unpowered relay protecting them. I have more scars than Tim Allens Charactor Tim THE TOOLMAN, and still lucky enough to count to ten.Originally Posted by niels
Now all that said I stayed up till 4:00 am making a program do exactly what he wanted as the whole thing intrigued the heck out of me! So the real question is :
Who's having fun out here?
You may change all the commands in the sub delay with a single pause 1600 (32x50).
Also you really need to change goto loop in the subs with return as Melanie said.
Ioannis
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