PDA

View Full Version : known incommodious behavior



wolff
05-07-2006, 06:12 PM
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

Bruce Bates
05-07-2006, 06:34 PM
Wolff -

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

Regards,

Bruce Bates

▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
<!--StartFragment -->

allanlane5
05-07-2006, 06:48 PM
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.

wolff
05-07-2006, 06:57 PM
thanks!!!!

Jon Williams
05-08-2006, 12:11 AM
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

wolff
05-08-2006, 06:46 AM
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 Williams
05-08-2006, 07:01 AM
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

wolff
05-08-2006, 08:11 AM
Thanks! I understand... I'm just a smart ***. Sorry

J