Shop OBEX P1 Docs P2 Docs Learn Events
known incommodious behavior — Parallax Forums

known incommodious behavior

wolffwolff Posts: 41
edited 2006-05-08 01:11 in BASIC Stamp
I am driving a relay and every few seconds (during sleep mode) it looses power for just a short time. I realize this is a known glitch. Can anyone recommend a simple fix?
Thanks!!!
·

Post Edited (wolff) : 5/8/2006 8:42:59 AM GMT

Comments

  • Bruce BatesBruce Bates Posts: 3,045
    edited 2006-05-07 11:34
    Wolff -

    Use PAUSE in lieu of SLEEP or NAP, and you won't have the problem.

    Regards,

    Bruce Bates

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    <!--StartFragment -->
  • allanlane5allanlane5 Posts: 3,815
    edited 2006-05-07 11:48
    The problem is that in 'sleep' mode, all the BS2 pins go to 'input' briefly every 2 seconds. You could use a 'latching' relay, or you could use a 'default' resistor (pull up or pull down). In the case of a relay, you probably don't want a 'default' state, though.

    If you're ALWAYS driving the relay driver, then probably a loop with 'PAUSE' is what you want to do. 'Sleep' is an ultra-low power mode, which saves a few milli-amps. You're probably driving the relay with much more than that, so saving a few milli-amps is not helping you.
  • wolffwolff Posts: 41
    edited 2006-05-07 11:57
    thanks!!!!
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-07 17:11
    This is not a "known glitch," this is a known behavior of the PIC watchdog in sleep mode.· From a programming standpoint it doesn't seem to make good sense to stop a program while leaving an output enabled.· But if you have to, use STOP instead of END.· I would tend to write a small subroutine that allows an escape mechanism:

    Latch_Relay:
    · DO
    ··· AlarmRelay = IsOn
    · LOOP WHILE (alarmBit = 1)
    · AlarmRelay = IsOff
    · RETURN

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • wolffwolff Posts: 41
    edited 2006-05-07 23:46
    Jon,
    Dude... You are all over it! One of Scott Edward publications referred to it as a "glitch." However I will reframe from ever using the "G" word again. From now on it's an "incommodious behavior".
    I'm using a BS1 so I don't think I can use a Do Loop.
    Thanks for all your help (Seriously!)
    J
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2006-05-08 00:01
    Here's how you do the same thing with a BS1:

    Latch_Relay:
    ··AlarmRelay = IsOn
    ··IF alarmBit = 1 THEN Latch_Relay
    · AlarmRelay = IsOff
    · RETURN

    Forgive me if I sounded defensive, that's not the case.· I just wanted to clarify something that is a known behavior of the underlying processor· -- something that is not a "glitch" as defined by the common usage of that term.· It's important to be clear about these sorts of things so that they're not taken out of context by newcomers.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • wolffwolff Posts: 41
    edited 2006-05-08 01:11
    Thanks! I understand... I'm just a smart ***. Sorry

    J
Sign In or Register to comment.