HI
i use 16F877A
how use interrupt on a port B (other that rb0) with 3 button.
for interrupt on RB4 to RB7 i must use intcon=00001000?
and intcon.0=0 to reset flag?
when i test this code . it dont work!
code:
' On Interrupt - Interrupts in BASIC
' Turn LED off on RA1 if Interrupt on PORTB.4
'
led var PORTA.1
trisa=1
LED=1 'just to see if port RA.1 is ok
pause 1000 '
OPTION_REG = $7f ' Enable PORTB pullups
On Interrupt Goto myint ' Define interrupt handler
INTCON =%00001000
loop: High led ' Turn LED on
Goto loop
' Interrupt handler
Disable ' No interrupts past this point
myint:
INTCON.0 = 0 ' Clear interrupt flag
low led ' If we get here, turn LED off
Pause 2000 ' Wait .5 seconds
resume ' Return to main program
Enable
with this code : led low and an action on rb4 nop
sample prog to use a port (other that RB0) and how use choice of different button?
please thank
Bookmarks