Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Strange PIC behaviour if i reapply power too quickly

Status
Not open for further replies.

netmgr

Member
Im having a problem with a 10f200 chip in that it works perfect on power up, but if i disconnect the power and reconnect it say within 5 seconds it activates a GPIO outout for no reason and seems unable to turn it off.

any thoughts? is it just a consequence of 'brown out'?
 
Im having a problem with a 10f200 chip in that it works perfect on power up, but if i disconnect the power and reconnect it say within 5 seconds it activates a GPIO outout for no reason and seems unable to turn it off.

any thoughts? is it just a consequence of 'brown out'?

It depends upon how far the +V supply has decayed before you reapply the +V, the PIC could power back up into an indeterminate state.
Do you have a R/C reset on the PIC.?
 
Last edited:
Im using GP3 as an input pin and as far as I can tell that should activate the internal POR?
the power is being removed completly(by me disconnecting the wire at the moment) and any residual should be used by an LED in parallel.
 
Im using GP3 as an input pin and as far as I can tell that should activate the internal POR?
the power is being removed completly(by me disconnecting the wire at the moment) and any residual should be used by an LED in parallel.

The LED will stop conducting when the +V falls below about 2.2V, so if you have decoupling caps on the +V line, it could be at 2.2V for a long time.

Try removing the +V, then quickly short out the PIC'a +V to 0V, remove the short and then reapply the +V, lets know what you see.
 
Hmm..I went thru an experience like that not so long ago. Turned out to be a combo of 2 things.

1) The PIC was new so PGM line had to be held low and not float. This was causing random fast resets.
2) I had to do a manual clear of ALL GPR to prevent registers' from having a 'memory' effect. Seems they hold memory down to 1.5V and the very capacitors that stabilise pwr cause this to become a possible reset prob. This becomes an issue if your registers aren't initialised properly. Somewhere along one (or more) of my 300 GPR that I used was causing the prob. I didn't spend the time to hunt it down. A simple blanket zeroing of all GPR stopped the prob.
 
ok, shorting the power does seem to clear the problem, so it seems the residual power seems to be held in the supply line capacitors powering the chip, and on resuming the power its causing odd results

im quite new to pics, heres my start up code, do you see any problems, specifically regards initialising the gpios?

include "p10f200.inc"
list st=off

__CONFIG _MCLRE_OFF & _CP_OFF & _WDT_OFF

radix dec

;--< hardware >----------------------------------------------------
#define ignition GPIO,0 ; GP0 = active hi ignition relay
#define starter GPIO,1 ; GP1 = active hi starter relay
#define radio GPIO,2 ; GP2 = active hi radio relay
;******************************************************************
; main program *
;******************************************************************
org 0x000
; call dbdelay ; 32-msec debounce delay
start
movwf OSCCAL ;
movlw b'10011110' ; 10011110
; 1-------, IOC off
; -0------, weak pullups on
; --0-----, T0CS source Fosc/4
; ---1----, T0SE edge hi>lo
; ----1---, PSA prescale WDT
; -----110, PS prescaler 64
option ;
movlw b'00001000' ;
tris GPIO ; GP3 input, all others outputs
clrf GPIO ; set output latches to '0'
clrf swtmr ; clear 1 second timer
clrc ; clear Carry
 
Last edited:
LEDs are very strange devices. They are light sensitive, and will generate approximately their forward voltage drop in sunlight.

Even in the dark, they will not take any current if the supply voltage is less than their forward voltage drop.

The memory retention voltage of a PIC is about equal to the forward voltage drop of an LED, so the voltage on the supply will stay at about that for a long time, as Eric said. That could keep the registers set on the PIC.
 
Um...I haven't used a 10 series but I am seeing some hi level conditional structures mixed into asm code. Are those compiler commands?
And where have u initialised the GPR registers u are using? Your code appears incomplete...ending with a clrc, the PIC will attempt to execute instructions after the clrc command....if that is the last instruction it ought to return the execution to the main code somehow or else anything can happen including the problem u describe.
 
thats just the start of the program, after that I await the press of a switch then do other stuff, but essentially after I reapply power it activates an output regardless of if it was on beforehand or if the switch is pressed.

as I say im new to this really, im a VB programmer normally so by all means im probably not doing something right

but as I say the program works flawlessly on a fresh power up from cold

Ive now edited the code to how I have it now....but same issue.
 
Last edited:
thats just the start of the program, after that I await the press of a switch then do other stuff, but essentially after I reapply power it activates an output regardless of if it was on beforehand or if the switch is pressed.

as I say im new to this really, im a VB programmer normally so by all means im probably not doing something right

but as I say the program works flawlessly on a fresh power up from cold

Ive now edited the code to how I have it now....but same issue.

hi,
If your power supply has a little extra current to spare, connect say a 470R directly across the +V and 0V, this should bleed away some of the caps charge.
 
I always put a 10k to 22k across the power rails to prevent this problem. I have had this problem many times, especially with PIC16F628's.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top