-
18F252 needs a jumpstart
This is my first use of an 18F device, MPASM and posting to this forum.
I'm moving from a 16F877 to an 18F252. My code assembles fine and loads without errors but does not run - there is no oscillation from resonator, so I'm sure it isn't a code problem. Shouldn't it work using the manual settings in the programmer, like HS for 20MHz, etc? Configuration does not NEED to be set in code, does it? Does this device need something really unique that I've missed from reading the manuals?
I built up a second board and it does the same. I'm quite sure it isn't hardware.
Thanks, Bob
-
Go to your datasheet and read the section on the oscillator options. The HS setting is only used with external crystals or resonators. You need to set the config fuses so the PIC knows to start out with the internal osc, and not an external one.
-
18F252 needs a jumpstart
I'm posting the resolution to this for the benefit of anyone who might come across this problem.
After trying several alternate fixes, what finally made it work was installing a 103 resistor across OSC1 and OSC2, along with the normal resonator circuit.
I did read the 18F252 manual long before my original post, which is why I bought the chip in the first place. On page 19 of 316, I see there is no internal oscillator to switch FROM, and HS IS the correct setting for external 20MHz resonators. The device does not seem to have 20MHz resonators listed, but FYI, mine now works! Also, code assembled and loaded without setting config bits within it. Manually setting config in the programmer worked, which I verified by reading the config back out of the programmed chip. MPASM was not a problem other than the length of the file path and it appears to have made my code about 5k longer, cancelling much of the gains of moving to a bigger chip. My blinker test code worked and everything else went as normal. I'm off and running.
I posted this hoping to avoid hammering out the solution to yet another PIC mystery and save some time.
Other than insulting my intelligence (READ! Why didn't I think of THAT?), giving wrong information, and not addressing a single issue in my post, this has been a great help.