I just began to tackle bare PICs again with the 12F509. Simple baseline stuff. Just for good measure as to whether or not I remembered what the hell I was doing, I tackled the task of turning on a LED. :p I used the following user code:
start ; begin user code
movlw b'000010' ; set GP1 to output
tris GPIO ; move literal from W to tris
movlw b'111101' ; set GP1 to high
movwf GPIO ; move literal from W to GPIO
goto $ ; loop forever
END ; Fin
Simple! I used the PICKIT 2 programmer and the LPC board and tried, both with MPLAB and PICKIT 2 software, to burn the code into the 12F509. Well the LED turned on, but it responds the pot on the LPC board. I don't know why. I'm pretty sure I turned on an LED with the 12F509 with the LPC board without this happening before...
Any thoughts?
Edit: 08.04.09 0208
What the code is meant to say it this:
movlw b'111101' ; configure GP1 as output
tris GPIO ; move data from W to tris
movlw b'000010' ; set GP1 high
movwf GPIO ; move data from W to register GPIO
goto $ ; repeat indefinetly
After suggesting the that pot could be connected to GP1, I tried using GP2 instead...well...GP1 was still high and lighting the LED which still responded to the pot. I tried clearing all of the bits, setting them all as inputs, and still the LED is lit up.
Before I bug anyone else about this issue, I'm going to check my wiring.
Edit: 08.04.09 0227
Well this is quite an awkward situation. My wiring was wrong. I had my LED connected to GP0 instead of GP1.
Also, I found that RA1 (Where the 12F509's GP0 is connected) on the LPC demo board is connected directly to the pot and responds directly to applied voltage whether or not a PIC is installed.
- Don't forget that microcontrollers require software (code) and hardware (wiring) so it's important to check both for bugs