list p=16f628
#include<p16f628.inc>
__CONFIG _MCLRE_ON & _CP_OFF & _WDT_OFF & _INTRC_OSC_NOCLKOUT
ERRORLEVEL -302
cblock 0x20
temp
temp_s
endc
org 0x00
goto main
org 0X04
inter:
movwf temp
swapf STATUS,w
clrf STATUS
movwf temp_s
btfsc PORTB,0x00
goto loop1
loop2:
movlw b'00000101'
movwf PORTA
btfsc PORTB,0x05
goto loop2
goto loop_x
loop1:
movlw b'10001000'
movwf PORTA
btfsc PORTB,0x00
goto loop1
loop_x
bcf INTCON,0x01
bcf INTCON,0x00
swapf temp_s,w
movwf STATUS
swapf temp,w
retfie
main:
bsf INTCON,0x07
bsf INTCON,0x04
bsf INTCON,0x03
bcf INTCON, 0x01
bcf INTCON, 0x00
bsf STATUS,RP0
movlw b'00100001'
movwf TRISB
movlw b'00000000'
movwf TRISA
bcf STATUS,RP0
movlw 0x07
movwf CMCON
Loop:
movlw b'00001001'
movwf PORTA ;set pin 0 of port a HIGH
goto Loop
END