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?
pic chip freezes on startup
- 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
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?
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?
Regards Ben Rowland - MatrixTSL
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Flowcode Product Page - Flowcode Help Wiki - Flowcode Examples - Flowcode Blog - Flowcode Course - My YouTube Channel
Re: pic chip freezes on startup
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
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 ?
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
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.
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
Hi all, just like to add that i have sorted the problem i had , 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.
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.