samuel23
Newbie level 1
I need help with write a program in assembly that increment the PORTD (LED) when there is pressing on keyboard.
i try to write somting but it's not work.
my program is:
LIST P=PIC16F877
include <P16f877.inc>
org 0x00
reset: nop
goto start
goto INTERRUPT
org 0x020
start:
bcf STATUS, RP0
bcf STATUS, RP1
clrf PORTD
clrf PORTE
clrf INTCON
bcf INTCON,GIE ; global interrupt enable
bcf INTCON,RBIE ; enabling change interrupt
bsf INTCON,RBIF
bsf STATUS, RP0
movlw 0XF0
movwf TRISB
clrf TRISE ;PORTE= output
clrf TRISD
clrf OPTION_REG
bsf OPTION_REG,7
movlw 0x06
movwf ADCON1
bcf STATUS, RP0
INTERRUPT:
movf PORTB,w
bcf INTCON,RBIF
btfss PORTB,4
goto minut_inc
retfie
minut_inc:
incf PORTD
END
i try to write somting but it's not work.
my program is:
LIST P=PIC16F877
include <P16f877.inc>
org 0x00
reset: nop
goto start
goto INTERRUPT
org 0x020
start:
bcf STATUS, RP0
bcf STATUS, RP1
clrf PORTD
clrf PORTE
clrf INTCON
bcf INTCON,GIE ; global interrupt enable
bcf INTCON,RBIE ; enabling change interrupt
bsf INTCON,RBIF
bsf STATUS, RP0
movlw 0XF0
movwf TRISB
clrf TRISE ;PORTE= output
clrf TRISD
clrf OPTION_REG
bsf OPTION_REG,7
movlw 0x06
movwf ADCON1
bcf STATUS, RP0
INTERRUPT:
movf PORTB,w
bcf INTCON,RBIF
btfss PORTB,4
goto minut_inc
retfie
minut_inc:
incf PORTD
END