; Using 20Mhz crystal at 0.2us every cycle.
list p=pic16f648a
include p16f648a.inc
__config _hs_osc & _lvp_off & _wdt_off & _pwrte_off & _cp_off & _boden_off
errorlevel -302 ;Eliminate bank warning
;**************** Initial Process *********************
org h'00'
goto main
org h'04'
goto main
main movlw d'07'
movwf cmcon ;CMCON=7 set comperators off
bsf status,rp0 ;Change to Bank1
movlw b'10100111' ;Set mode for PORTA
movwf trisa ;Set PORTA pin 0-2 to Input mode
clrf trisb ;Set PORTB to Output mode
bcf status,rp0 ;Change to Bank0
bcf intcon, inte
bcf intcon, gie ;disable interrupts
;**************** Clear Variables *********************
clrf porta
clrf portb
;**************** Simple Code *********************
wait bcf portb,2 ;off led
btfsc porta,2 ;check if switch is press
bsf portb,2 ;on led if switch is press
goto wait ;loop back
end