> __CONFIG _CP_OFF & _MCLRE_OFF & _WDT_OFF & _IntRC_OSC
Aren't you supposed to combine configuration flags with '|' or '+', not
'&'? ANDing together a series of bit flags is guaranteed to give you a
zero - I'm not sure exactly what effect a zero has as the configuration
word, but I suspect it's setting the PIC for an external clock or something
else incompatible with how you've wired your circuit.
> START MOVLW B'11000010'
> MOVLW 0
> MOVWF GPIO
> MOVLW 0
> TRIS GPIO
> OPTION
That first MOVLW is accomplishing nothing, since you immediately overwrite
W with a zero. I suspect that the value 11000010 was intended to go into
the OPTION register, but you inserted some other code in between. The main
effect of your storing 0 in OPTION instead is to set the Timer0 prescaler
to 1:2 instead of 1:8. This would make your LED blink 4 times as fast as
it should, but wouldn't explain why it doesn't work at all - I'm pretty
sure that the config word is your real problem.
Jason Harper
I did notice that the program is full of instances of consecutive bit operations on the GPIO port, never a good thing to do.
Also I think the delay routine may be a bit dodgy. The coments are mine, but I'm trying to illustrate the fact that to work properly, the timer would have to roll over to zero exactly as the MOVF TMR0,W instruction is being executed. It's hardly worth using the timer for delays like this. As you are using 100% cpu time polling the timer, you might just as well use a pure software delay.
DLY100 MOVLW 100 ; do 100 timer loops
DLYMS MOVWF LOOP1
DY0 MOVLW -125 ; pre-load TMR0 with -125
MOVWF TMR0
DY1 MOVF TMR0,W ; grab TMR0 register (timer must be zero here to work properly)
IORLW 0 ; is it zero? (might roll over to zero here)
BTFSS STATUS,Z (or here)
GOTO DY1 ; no check again (or here)
DECFSZ LOOP1,F ; yes, decrement outer loop
GOTO DY0
The fact that the voltage on the ports is rising to 1.7 volts suggests that the pin is configured as an input and is floating. This ties in with the incorrect CONFIG. The ports default to input on power up, and if the PIC isn't running it'll never get configured as an output.
Mike