pic chip freezes on startup

Any general or miscellaneous queries that do not fit into the other forum catagories

Moderators: Benj, Mods

Post Reply
chevy6600
Flowcode V4 User
Posts: 115
Joined: Fri Feb 22, 2008 6:38 pm
Contact:

pic chip freezes on startup

Post 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?

User avatar
Benj
Matrix Staff
Posts: 15312
Joined: Mon Oct 16, 2006 10:48 am
Location: Matrix TS Ltd
Has thanked: 4803 times
Been thanked: 4314 times
Contact:

Re: pic chip freezes on startup

Post 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?

chevy6600
Flowcode V4 User
Posts: 115
Joined: Fri Feb 22, 2008 6:38 pm
Contact:

Re: pic chip freezes on startup

Post by chevy6600 »

Hi benj, i am using 18F2620 and have ADC inputs on RA1 & RA2 , vref-, and vref+, outputs are on RC port.

WalkOver
Posts: 65
Joined: Fri Nov 23, 2007 11:24 pm
Contact:

Re: pic chip freezes on startup

Post 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 ?

chevy6600
Flowcode V4 User
Posts: 115
Joined: Fri Feb 22, 2008 6:38 pm
Contact:

Re: pic chip freezes on startup

Post 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.

chevy6600
Flowcode V4 User
Posts: 115
Joined: Fri Feb 22, 2008 6:38 pm
Contact:

Re: pic chip freezes on startup

Post 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.

User avatar
Steve
Matrix Staff
Posts: 3422
Joined: Tue Jan 03, 2006 3:59 pm
Has thanked: 114 times
Been thanked: 422 times
Contact:

Re: pic chip freezes on startup

Post by Steve »

Glad you found the problem, and thanks for letting us know.

Post Reply