pic model ?
pic model ?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Read portB on entry into the interrupt routine to end the mismatch condition.
SomeVar = PORTB ' read portB
Then clear the interrupt flag before exiting your interrupt routine.
INTCON.0 = 0 ' RB port change int flag is cleared.
Now whenever portB is different from the last value read, INTCON.0 will be set, and you'll vector back to your interrupt routine.
Read this app note for more details:
http://ww1.microchip.com/downloads/e...tes/00566b.pdf
Last edited by Bruce; - 2nd February 2006 at 17:37.
i solved the problem with another method as below
trisa=%00000
trisb=%11111111
option_reg=%10000000
intcon = %10001000
I var byte
on interrupt goto int
main:
back: if portb<>0 then intcon=%10001000 ; test bit 3
serout porta.0,2,[254,1]
pause 10
serout porta.0,2,["Hello"]
pause 100
goto main
disable interrupt
int:
for i=0 to 5
serout porta.0,2,[254,1]
pause 10
serout porta.0,2,[#i]
pause 1000
next i
INTCON=%10000000 ; cleared bit 3 bit
goto back ; back to test
resume
enable interrupt
end
i will read document, thank u for that, and waiting a reply from Mister_e
Last edited by micro; - 2nd February 2006 at 22:53.
Micro,
Maybe your solution is working but will Behave weird one day or another.
I've nothing else to add from the Bruce's explanation. Everything is covered in his document.
AND it's also covered in the PORTB TRISB section 3.2 of your datasheet too.
BTW, why using interrupt on PORTB<7:4> if you never test wich pin gives you the interupt?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Just a longer way to read PORTB ... no other method here !!!Originally Posted by micro
Elegant solution would have been to display the port where the interrupt came from, in the "serout"
Alain
Last edited by Acetronics2; - 3rd February 2006 at 10:39.
************************************************** ***********************
Why insist on using 32 Bits when you're not even able to deal with the first 8 ones ??? ehhhhhh ...
************************************************** ***********************
IF there is the word "Problem" in your question ...
certainly the answer is " RTFM " or " RTFDataSheet " !!!
*****************************************
Bookmarks