PDA

View Full Version : Keep DIO from toggling



rwskinner
- 27th June 2008, 14:56
Is there a way to keep the Digital outputs on a 18F4520 from changing states when the pic gets reset with a MCLR? I don't remember this happening on my other pic projects with 16F series.

My issue is the pic controls relays which controls valves and solenoids and I really need to keep them in a known state and not change states during a reset.

Outputs are setup to sink, Like this 24 volts to Relay Coil, Relay coil to Transistor, Transistor goes to ground. Digital Out controls transistor. No pull ups or downs.
Example Pin, RC3

skimask
- 27th June 2008, 15:13
On reset, all pins go to inputs, so if you have them 'pulled' to a default state (or at least a 'fail-safe/operational' state) with a pullup/pulldown, you should be ok. Then you can read the last state stored in eeprom, set the logic level on the pins, and change the pins to outputs as required. I would think it should be relatively easy to patch in a few pullup/pulldown resistors to a pin or two here and there.

Past that, sounds like some battery backup would be needed, or maybe some external latching relays.