I have been using the 12F510 for a project for a while but chose to upgrade to the 12F609 because of the greater number of internal pullups and interrupts. Since size and part count are critical in my project I was running the 12F510 on the internal oscillator. This was going fine, but when I tried to get the 12F609 working I had no luck.
All I'm trying to do at this stage is get a simple port toggling programme running, once I've got that working my actual code can easily be ported from the 12F510 to the new PIC.
The toggle code is below.
Code:
#CONFIG
ifdef PM_USED
device pic12F609, intoscio, wdt_on, mclr_off, ioscfs_8mhz, protect_off
else
__config _INTOSCIO & _WDT_ON & _MCLRE_OFF & _IOSCFS_8MHZ & _CP_OFF
endif
#ENDCONFIG
DEFINE OSC 8
ANSEL = 00000000
TRISIO = 0
MAIN_LOOP:
high GPIO
pause 1000
low GPIO
pause 1000
goto main_loop
Obviously it just toggles the outputs each second. The code compiles fine and I uploaded it onto a PIC, then connected an LED up to GP2 (through a resistor) to monitor the state of the output.
When I powered the PIC up the code doesn't seem to run correctly. The LED will either be on or off constantly without changing.
I'm guessing that I've missed something in the configuration, but I don't know what. As far as I can tell the #config block is correctly set up for internal oscillator, 8MHz, digital I/O on all pins and MCLR off. Inputs are all set to digital (although that shouldn't matter when using the pins as outputs, if I'm reading the datasheet correctly) and all the pins are set as outputs.
I'm stumped as to why it doesn't work, but there must be something I've missed. If anyone could offer any suggestions I would be very appreciative.
Bookmarks