PDA

View Full Version : Question PIC 12F629 problem - need experts help


pmackenzie
Jul 03, 2006, 04:17 PM
I have a project using a 12F629. Software is all done, but I am hitting a hardware snag.
Power is provided by the BEC in a CC10, or via a PARKBec when using an Opto controller.
( I tried it both ways)
Everything works fine if I connect it after the motor battery is connected, but the PIC seems to be hanging if I let it power up along with the ESC.
I need all 6 I/O, so MCLR is disabled.
Here is the configuration directive:

__config _CP_OFF &_WDT_OFF &_PWRTE_ON &_INTRC_OSC_NOCLKOUT &_MCLRE_OF

There is a .1uF power supply bypass cap.
I added a 10uF filter cap in parallel but it made no improvement.

Short of adding a power switch, any suggestions?

Thanks,
Pat MacKenzie

around
Jul 03, 2006, 05:38 PM
Pat,

Try enabling the Brown Out Reset function in your config settings.

Cheers,

Adrian

pmackenzie
Jul 03, 2006, 05:45 PM
My question turned you from probable "lurker" to member! Cool.
Welcome to rcgroups.

I will try that.
Thanks,
Pat MacKenzie

pmackenzie
Jul 03, 2006, 06:32 PM
Brownout made no difference.
I added some diagnostics (LED flashes) and it seems to be a code problem.
The micro starts every time, then just gets lost in the middle somewhere. :mad:

Pat MacKenzie

around
Jul 03, 2006, 08:04 PM
Have you run the code through the MPLAB simulator to see if it functions corectly?

If you would like another set of eyes to look at the code, send me a copy off-line.

Cheers,

Adrian

thanhTran
Jul 03, 2006, 09:12 PM
Try using it with a seperate battery pack first. I had a funny problem a while back and it seemed to disable some IO port when the radio saw some glitches.

pmackenzie
Jul 03, 2006, 09:34 PM
I think (I hope!) I have it working now.
Adding the diagnostics moved a jump table over a page boundary. Not good.
Fixed that and then found a problem with an un-initialized variable in the same routine.
It was lifted from another web site (//www.mcmanis.com/chuck/robotics) . Seemed to work right off the bat, so I didn't try to figure out the details.

Thanks for the offer Adrian, but I think my coding style is a bit like the 1,000,000 monkeys trying to write Shakespeare.
It works in the end, but is not always pretty.
I usually find by the time it is done it is time to re write it from scratch :)

I never had much luck with MPsim with a real time I/O based app.
It is good for checking program flow and smaller code chunks, but for the entire application it is just too slow.
Pat Mackenzie