All I'm trying to do is get 5 lights to blink 3 times at start up, stay off for a brief time, and then have each light come on and go off (while the others stay off) in order of the port bit they are attached to.
The start of the program works fine, all 5 lights blink 3 times and then stay dark for a couple seconds. Once it gets to the LOOP, the light attached to PORTB,1 flashes constantly while the others behave like I'm expecting.
I've rewritten this thing about 20 times trying to figure out why, it's driving me nuts. I'm not so interested in the right way to do this, I'd prefer to find that out myself, I'm more interested in knowing why the PORTB,1 this isn't working the way I expect it to, thanks.
FYI, I've been screwing around with this for so long, some of the comments are out of date.
The start of the program works fine, all 5 lights blink 3 times and then stay dark for a couple seconds. Once it gets to the LOOP, the light attached to PORTB,1 flashes constantly while the others behave like I'm expecting.
I've rewritten this thing about 20 times trying to figure out why, it's driving me nuts. I'm not so interested in the right way to do this, I'd prefer to find that out myself, I'm more interested in knowing why the PORTB,1 this isn't working the way I expect it to, thanks.
Code:
main
PORTSU
movlw 0x07
movwf CMCON
bsf STATUS, RP0 ;switch to bank1
movlw b'00000000' ;put 0x0 into w
movwf TRISA ;copy w into trisa makes pin 17 an input
movlw b'00000000' ;set all portB pins to inputs
movwf TRISB ;
bcf STATUS, RP0 ;move back to bank0
STARTUP
movlw b'11111111' ;make all pins on portb hot
movwf PORTB ;
call DELAY
movlw b'00000000' ;make all pins on portb low
movwf PORTB
call DELAY
movlw b'11111111'
movwf PORTB
call DELAY
movlw b'00000000' ;make all pins on portb low
movwf PORTB
call DELAY
movlw b'11111111'
movwf PORTB
call DELAY
movlw b'00000000' ;make all pins on portb low
movwf PORTB
call DELAY
call DELAY
call DELAY
call DELAY
LOOP
movlw b'00000001'
movwf PORTB
call BLINK
movlw b'00000010'
movwf PORTB
call BLINK
movlw b'00000100'
movwf PORTB
call BLINK
movlw b'00001000'
movwf PORTB
call BLINK
movlw b'00010000'
movwf PORTB
call BLINK
goto LOOP
DELAY
d1 decfsz count1,1 ;
goto d1 ;
decfsz count2,1 ;
goto d1 ;
return ;
BLINK
call DELAY
movlw PORTB
movwf save
movlw b'00000000'
movwf PORTB
call DELAY
movlw save
movwf PORTB
call DELAY
return
FYI, I've been screwing around with this for so long, some of the comments are out of date.