I don't see any interaction between the timer0 and port B. How fast are you running the micro? How much processing time is your 10mS timer taking up? How are you timing the debounce routine? Does the chip configuration differ between the two examples you've provided (timer enabled vs disabled)? Are you properly reseting the timer0 interrupt flag at the end of the timer0 routine? You may have to post the code so we can better see how things are interacting. If I were debuggin this I'd start from the bottom - copy the bit for a button in portb to another pin set as output and make sure that it's being read correctly (tests that the pin is an input, and that no other configuration is consuing the pin). Then pipe the output of the debounce routine to the output pin. Find out whether it's a debounce problem or a pin configuration problem. If it misses in debounce, start looking into the code to see where the signal disappears. If it happens before debounce double and triple check the configuration of portb and everything that has anything to do with it. The bug has got to be in there _somewhere_... -Adam On 8/6/08, Erik Reynolds wrote: > I'm polling PORTB in a neat little debouncing routine I was taught in > class last semester. > > On Wed, Aug 6, 2008 at 11:50 AM, Michael Rigby-Jones > wrote: > > > > > >> -----Original Message----- > >> From: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] On > > Behalf > >> Of Erik Reynolds > >> Sent: 06 August 2008 16:37 > >> To: piclist@mit.edu > >> Subject: [PIC] Need help with Timer0 / PORTB Input > >> > >> Hi All, > >> > >> This is my first time posting here. I have been designing a countdown > >> timer that uses a PIC16F872 running at 4 Mhz. It allows the user to > >> enter in a time in seconds ranging from 00.0 to 99.9, and then press a > >> button to start a countdown. The code uses Timer0 with a pre-scaler > >> of 1:8 set to 133 so that it interrupts every 10 ms. Every ten > >> interrupts, it calls a function that 'clocks' a tenth of a second. In > >> the meantime, the chip is continuously outputting the current value > >> for time. My issue is that while the countdown works flawlessly, I > >> can't get any button input on PORTB. However, when I comment out my > >> timer0 interrupt routine, and the statement where I enable the timer0 > >> interrupt initially, the button input works just fine. > >> > > > > Are you trying to use the PORTB "Interrupt on change" feature, or are > > you just polling the button input? > > > > Regards > > > > Mike > > > > ======================================================================= > > This e-mail is intended for the person it is addressed to only. The > > information contained in it may be confidential and/or protected by > > law. If you are not the intended recipient of this message, you must > > not make any use of this information, or copy or show it to any > > person. Please contact us immediately to tell us that you have > > received this e-mail, and return the original to us. Any use, > > forwarding, printing or copying of this message is strictly prohibited. > > No part of this message can be considered a request for goods or > > services. > > ======================================================================= > > > > -- > > http://www.piclist.com PIC/SX FAQ & list archive > > View/change your membership options at > > http://mailman.mit.edu/mailman/listinfo/piclist > > > > > > -- > -Erik J. Reynolds > -- > http://www.piclist.com PIC/SX FAQ & list archive > View/change your membership options at > http://mailman.mit.edu/mailman/listinfo/piclist > -- EARTH DAY 2008 Tuesday April 22 Save Money * Save Oil * Save Lives * Save the Planet http://www.driveslowly.org -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist