Hi Everybody!!
i ve got a problem , cant get an button click , i mean, RB(4-7) pin change interrupt,! im working on PIC16f84, MPLAB IDE , !help me please, this is my code, very simple:
Thank you
i ve got a problem , cant get an button click , i mean, RB(4-7) pin change interrupt,! im working on PIC16f84, MPLAB IDE , !help me please, this is my code, very simple:
Rich (BB code):
list p=16f84
include p16f84.inc
__CONFIG _CP_OFF & _WDT_OFF & _PWRTE_ON & _XT_OSC
org 0x00
goto Main
org 0x04
goto ISR
Main
BSF STATUS,RP0
MOVLW B'00100000' ;RB5 set to input
MOVWF TRISB
MOVLW B'10000000'
MOVWF OPTION_REG ;RBPU, set OFF
BCF STATUS,RP0
CLRF PORTB
BSF PORTB,1 ; Turn on PORTB(1)
BSF INTCON,RBIE ; enable rb(4-7) interrupt
BSF INTCON,GIE ;enable global interrupt
MainLoop
nop
goto MainLoop
ISR
BTFSS PORTB,1
goto TurnOn
BCF PORTB,1
BCF INTCON,0 ;clear interrupt flag before return
RETFIE ;return from interrupt
TurnOn
BSF PORTB,1
BCF INTCON,0 ;clear interrupt flag before return
RETFIE ;return from interrupt
END