PDA

View Full Version : Some questions for programming



fnovau
- 25th June 2006, 21:07
I use PBP + MicroCode Studio plus and Picstart+ for 12F675 I should need to know some basic questions concerning the following points of programming:
1- Is there any advantage to use WDT on? My programs are very linear and I never use Sleep sentences but I realize my compiled files use many times along the program WDToff code. Could be my code more save if I disable WDT at the beginnig of program?
2- My MCLR is tied to +5 through a 10K resistor without capacitor. When I try ICSP Picstart doesn't permit to do it -GP0 and GP1 are not conected to application circuit- Whats the difference between MCLR internal or external programming? If I set MCLR internal do I need 10k resistor?
3- If I don't use Power up timer whats the best setting for programming: on or off option?
Regards
-Francesc

modifyit
- 26th June 2006, 04:43
This may not answer your question, but something to watch out for on the 12F675.

Make sure you do not try to use the MCLR pin as an input and use the Internal Oscilator at the same time This does not work for some reason and can make chips useless.

I have the mclr pin through a diode and then a 10K to 5v with no problems. I have the MCLR set to be used as a reset pin (not input) and the INTOSC on.

To try to answer your other questions:

1) the WDT is good to use...if your program locks up for a random reason the WDT will reset the microchip after a period of inactivity. If you are having erratic results with your code you may want to turn the WDT config fuse off while you troubleshoot to make sure the WDT is not causing an issue.

2)See number above, but to expand I would just always setup the MCLR pin as a reset pin with a 10k and a diode to be safe

3) If you don't want to use the power on timer, just make sure you set the config fuse to OFF

paul borgmeier
- 26th June 2006, 07:11
Make sure you do not try to use the MCLR pin as an input and use the Internal Oscilator at the same time This does not work for some reason and can make chips useless.
Somebody forgot to tell my 12F675 parts because they all work great in this mode. It appears nobody has told microchip either :)

1) Modifyit is right - WDT is good to stop lockups. Because PBP normally does not know if you will set the WDT fuse or not, the code length is the same regardless. If you do not plan to use the WDT and are really squeezed for space, you can insert

DEFINE NO_CLRWDT 1

at the beginning of your code for a very modest savings in code space. If you are planning to use sleep commands (which you said you are not), it is better to use the WDT (if you want them to work).

2)
If I set MCLR internal do I need 10k resistor?
No - there is not one in place if you program in the PSP ZIF, not one needed for ICSP. You probably need the diode as suggested my modifyit - it depends on your circuit.

3) If you set the fuse for Power up timer, you are using it (you have no choice with the fuse set). Setting this bit keeps the processor in reset for 72 mS at power up - see datasheet. I like mine on but it depends on what you are doing.

Paul Borgmeier
Salt Lake City, Utah
USA

mister_e
- 26th June 2006, 16:38
Make sure you do not try to use the MCLR pin as an input and use the Internal Oscilator at the same time This does not work for some reason and can make chips useless.

MIIP bad answer, there's no reason, no link between them. I use this setup often and never encounter any kind of problem.

PicStart is often bad when using in ICSP. Also he's very noise sensitive, so keep wires short, use the 10K+Diode... TADA no problem when doing it. In some case, if you set the weak-pull up it may cause you some erratic boot-up problem... but reset the whole thing will work. This problem doesn't seems to happen with a real ICSP capable programmer like BK Precision 844a (Elnec).

Go go go, use internal OSC, use MCLR as input but... have some respect to the hardware requirement.

In some case, PICStart ICSP will work better if you let him power your PIC... yeah it's a pain, close your external PSU, program, then turn on your power supply.... that's annoying but it's working.

modifyit
- 5th July 2006, 16:04
I will try and dig up the email I got from PBP support concerning using the MCLR Pin as an Input and the INTOSC at the same time. I fried a bunch of 12F675's trying to do it, and PBP support responeded to my questions saying that it was not recommended on the 12F675.