{Quote hidden}>
> Here's what the ISR looks like:
>
> org 0x04
> ISR ;RB0int service routine
> rlf PORTB,F
> <------------- ;bit 1 holds switch state (high),
> lighting up ;led1 additionned to the other one
> (whichever) bcf PORTB,RB1 ;turn it back
> off <-------------
> btfss STATUS,C ;have we gone past led 7 (shifted
> ;RB7 to carry)
> goto skiprewind ;skip if not
>
> bcf STATUS,C
> bsf PORTB,RB1 ;start again at RB1 (led 1)
> skiprewind
> ;now put back INTCON the right way
> bcf INTCON,INTF ;clear ext. int. flag
> bsf INTCON,GIE ;enable ints
>
> RETFIE
>
It would rather be:
{Quote hidden}> org 0x04
> ISR
> movf PORTB
> andlw b'1111 1110' ;ignore state of RB0
> movwf tempPORTB ;put in temp file
> rlf tempPORTB,f ;rotate and store in F
>
> btfss STATUS,C ;was last led on RB7 (now in carry)
> goto skip
> bcf STATUS,C ;erase carry
> bsf tempPORTB,RB1 ;start again at RB1
> skip
Here I forgot to put in
movf tempPORTB
movwf PORTB
which is kind of important.
> bcf INTCON,INTF
> bsf INTCON,GIE
> RETFIE
> ...
--
http://www.piclist.com hint: The PICList is archived three different
ways. See http://www.piclist.com/#archives for details.