Let's Make Robots!

PIC and PICkit Problems

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.

 

Anyway, I guess let's look at the bright side and try to learn a lesson from this. 
  • Don't forget that microcontrollers require software (code) and hardware (wiring) so it's important to check both for bugs 

 

 
Thanks for the help Telefox, and sorry for wasting your time. 

 

 

 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

"movlw b'111101'      ; set GP1 to high"
You're setting GP1 to ouput low here (in contrst to what the comment says), so I assume that because your LED does in fact light up, you've connected it from V+ to GP1?

As far as the trimpot affecting the LED, is it possible the trimpot's wiper terminal is connected to GP1, which on other micros is one of the analog inputs?

My bad, I meant:

movlw b'000010;

movwf GPIO 

I should have just copied and pasted :\

Look at the edit for more info 

No problem, if my suggestion helped you find the problem a little faster then I wouldn't consider it a waste of time.