Delay problem


Closed Thread
Results 1 to 12 of 12

Thread: Delay problem

Hybrid View

  1. #1
    niels's Avatar
    niels Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by Joe S.
    I would not trust a PIC with my fingers!
    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.

  2. #2
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Talking So the real question is . . .

    Quote Originally Posted by niels
    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.
    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.

    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?

  3. #3
    Join Date
    Nov 2003
    Location
    Greece
    Posts
    4,115


    Did you find this post helpful? Yes | No

    Default

    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

  4. #4
    Join Date
    Aug 2006
    Location
    Look, behind you.
    Posts
    2,818


    Did you find this post helpful? Yes | No

    Default Code for Lloyd

    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!

Similar Threads

  1. 16F628A - Stops if release power switch.
    By dene12 in forum General
    Replies: 16
    Last Post: - 14th February 2009, 07:57
  2. Old and beyond help ?
    By DavidFMarks in forum mel PIC BASIC Pro
    Replies: 46
    Last Post: - 11th December 2008, 15:23
  3. need a project for PIC16F84
    By Danish in forum Schematics
    Replies: 6
    Last Post: - 3rd August 2005, 17:51
  4. Memory Space of the PIC16F84...
    By Tear in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 1st July 2005, 19:55
  5. Problem with saving to EEPROM...
    By Tear in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 1st July 2005, 00:10

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts