Brooke, subwf ms_counter,W btfsc STATUS,Z <-bit test file skip when clear. banksel PORTB ; NEED banksel here or bcf PORTB,7 ; bcf PORTB,7 ; heart beat off PC4 Testing I find the code as follows. When the ms_counter result is non zero it skips banksel and bcf. But when it is zero it executes banksel. Now the thing is bcf and banksel has to go hand in hand. Select the correct bank for PORTB before using PORTB. I cannot explain why your LCD gets corrupted since I can't see all the code and schematics. Regards, John --- Brooke Clarke wrote: > Hi: > > My clock program uses an ISR triggered from Timer2 > once every 1.0 ms. > In the ISR there is code that turns on an LED at the > top of the second > and turns it off after 10 ms. I'd like to use the > LED for debugging and > so commented out the two lines that control the LED, > but after doing > that the LCD display turned to garbage. It turns > out that placing a > "banksel PORTB" at the end of the ISR fixes the > problem when the LED > code is commented out. But I don't understand why? > > Have Fun, > > Brooke Clarke > > Here is the end of the ISR code: > > End_ISR > movlw .10 ; 10 ms on (1 ms is too short) > subwf ms_counter,W > btfsc STATUS,Z > banksel PORTB ; NEED banksel here or bcf PORTB,7 > WHY-O-WHY > ; bcf PORTB,7 ; heart beat off PC4 Testing > Switches << inorder to work, > ; commenting out the bsf and bcf lines causes the > clock to > ; have garbled display. Why? > ; --- pop pclath, status & w --- > movf PCLATH_TEMP,W > movwf PCLATH > swapf STATUS_TEMP,W > movwf STATUS > swapf W_TEMP,F > swapf W_TEMP,W > retfie ; turns on GIE > ;================== End of ISR > =========================== > > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist