Page 1 of 1

pic chip freezes on startup

Posted: Tue Jan 20, 2009 9:08 am
by chevy6600
Hi guys, can you please help with this problem?. I have got my pwm servo program to read 2 voltage inputs via ADC, the program generates PWM signal then the program adjusts PWM signal depending on the outcome of the ADC. Well, when i first start up the processor....ie. the actual hardware.....i can see that the program runs as it should because i have a led that comes on ever 4000 program loop cycles, and this led is flashing on/off as expected. But the ADC seems to be jammed as though it is receiving a high voltage....it is not as i have tested the voltage.....i even tried earthing it!
After about 5 or 10 minutes the problem goes away and begins to read the ADC correctly and all is well!
This problem does not appear in proteus and i have tried 2 chips.

I have not connected any input/output pins that i do not use,
Q. Do i need to pull up or pull down the unused pins?
Q. if so, please explain the method...resistor?...earth?...etc.
Q. is there anything else that could cause this problem?

Re: pic chip freezes on startup

Posted: Tue Jan 20, 2009 10:17 am
by Benj
Hello

Nothing I can think of other then channel bleedover however this should not happen using the Flowcode sample routines as the input channel is stabilised before the sample occurs. Also no way this can last for 5-10 mins really. Which chips are you using and which analogue input pin is causing this effect?

Re: pic chip freezes on startup

Posted: Tue Jan 20, 2009 10:28 am
by chevy6600
Hi benj, i am using 18F2620 and have ADC inputs on RA1 & RA2 , vref-, and vref+, outputs are on RC port.

Re: pic chip freezes on startup

Posted: Wed Jan 21, 2009 8:38 pm
by WalkOver
Do you respect the maximum impedance for your ADC ?

Do you have a fairly powerful regulator ? ( because of your servomotors )

Do you put 100nF on the PIC power pin ? On the Servo power pin ?

Re: pic chip freezes on startup

Posted: Wed Jan 21, 2009 11:45 pm
by chevy6600
Hi walkover, thanks for the tips.
I have a voltage divider setup using a 1k potentiometer to get a spread of 0v - 5v, this then supplies the ADC.
I am supplying the servo from a separate battery.
Yes i have the 100nf capacitor in place....with other capacitors as well.
I can get a small test program to work O.K. but not my more complicated program. :|
I`ll look at my programing a bit more deeply.

Re: pic chip freezes on startup

Posted: Thu Jan 22, 2009 4:51 pm
by chevy6600
Hi all, just like to add that i have sorted the problem i had :mrgreen: , it was an integer variable that was not first
initialised at the beginning of the program...i guess it was erratically first starting up with a negative number
and having to work up to the `0` figure. Might be of something to bare in mined.

Re: pic chip freezes on startup

Posted: Thu Jan 22, 2009 4:56 pm
by Steve
Glad you found the problem, and thanks for letting us know.