;RB0 controls RB7 and RA0
;===>if RB0=0 then RB7 and RA0=0, else it will be 1 when RB0=1
;RB1 controls RB6 and RA1
;RB2 controls RB5 and RA2
;RB3 controls RB4 and RA3
list p=16F84A ; list directive to define processor
#include <p16F84A.inc> ; processor specific variable definitions
errorlevel -302, -207
__config _CP_OFF &_XT_OSC & _PWRTE_ON & _WDT_OFF
cntr1 equ h'21'
cntr2 equ h'22'
ORG 0x000 ; processor reset vector
goto main ; go to beginning of program
ORG 0x004 ; interrupt vector location
nop
retfie ; return from interrupt
main:
bsf STATUS,RP0
movlw b'00000'
movwf TRISA
movlw b'00001111'
movwf TRISB
bcf STATUS,RP0
loop:
btfss PORTB,0
goto sw1on
bsf PORTB,7
bsf PORTA,0
goto sw2
sw1on:
bcf PORTB,7
bcf PORTA,0
sw2:
btfss PORTB,1
goto sw2on
bsf PORTB,6
bsf PORTA,1
goto sw3
sw2on:
bcf PORTB,6
bcf PORTA,1
sw3:
btfss PORTB,2
goto sw3on
bsf PORTB,5
bsf PORTA,2
goto sw4
sw3on:
bcf PORTB,5
bcf PORTA,2
sw4:
btfss PORTB,3
goto sw4on
bsf PORTB,4
bsf PORTA,3
goto loop
sw4on:
bcf PORTB,4
bcf PORTA,3
goto loop
slow:
movlw 0XFE
movwf cntr1
movlw 0XFE
movwf cntr2
del1:
movlw 0XFE
movwf cntr2
del2:
decfsz cntr2,F
goto del2
decfsz cntr1,F
goto del1
return
end