futz
Active Member
The 6 LEDs on 3 pins threw me for a bit, but I think I've got it figured out now. But I can't get LED1 or LED6 to work.
Here's my table:
LEDs 2 thru 5 work perfect. 1 and 6, not so much.
And here's the code:
Here's my table:
LEDs 2 thru 5 work perfect. 1 and 6, not so much.
And here's the code:
Code:
#include <p18f1320.inc>
cblock 0x00
d1
d2
d3
endc
org 0x0000
bsf OSCCON,IRCF2
bsf OSCCON,IRCF1
bsf OSCCON,IRCF0
clrf TRISA
clrf TRISB
bcf PORTA,RA0
bcf PORTA,RA6
bcf PORTA,RA7
Main bsf PORTA,RA0 ;led1
bcf PORTA,RA6
bsf TRISA,7
call Delay
call alloff
bcf PORTA,RA0 ;led2
bsf PORTA,RA6
bsf TRISA,7
call Delay
call alloff
bsf TRISA,0 ;led3
bsf PORTA,RA6
bcf PORTA,RA7
call Delay
call alloff
bsf TRISA,0 ;led4
bcf PORTA,RA6
bsf PORTA,RA7
call Delay
call alloff
bcf PORTA,0 ;led5
bsf TRISA,6
bsf PORTA,RA7
call Delay
call alloff
bsf PORTA,0 ;led6
bsf TRISA,6
bcf PORTA,RA7
call Delay
call alloff
goto Main
alloff clrf TRISA ;all leds off
bcf PORTA,RA0
bcf PORTA,RA6
bcf PORTA,RA7
; call Delay
return
Delay movlw 0x01
movwf d1
movlw 0x9f
movwf d2
movlw 0x01
movwf d3
Delay_0 decfsz d1,f
goto $+6
decfsz d2,f
goto $+6
decfsz d3,f
goto Delay_0
return
end