On Wed, 12 Jun 1996, Martin J. Maney wrote: > On Wed, 12 Jun 1996, Neil Gandler wrote: > > > On Tue, 11 Jun 1996, Martin J. Maney wrote: > > > There's the work-around described in the datasheet (this has been in > > > there for at least some of the 16Cxx parts for a while): > > > > > > "The interrupt on change feature is recommended for wake-up on key > > > depression operation and operations where PORTB is used only for the > > > interrupt on change feature. Polling of PORTB is not recommended > > > while using the interrupt on change feature." > > > > > > > So are you saying that if someone was to use a pin on port B with > > the interrupt on change, that the rest of the ports pins shouldnt be > > used for any other application? > > I don't quite understadn what you meant. > > No, you've got it, near enough. As John has explained (and given a nice > example of its intended use), this really isn't of much use as a general > interrupt source as you might expect in a general purpose machine. > > About all I can think of to add is the observation that even if you can > afford to "waste" the rest of PORTB this probably can't be made entirely > reliable for more general use. The catch is that you HAVE to read the > port in order to clear the interrupt that has occured, and that read can > cause another interrupt to be missed. Not very often, perhaps, but if > you can't afford to miss the change... (and, I tend to think, if you > could afford to miss an occasional change, forget about the interrupt on > change and just poll it from time to time and detect the changes > yourself - as many pins, on whatever ports as you need.) > ____ I just want to make sure I got this. If I have one input on PORT B lets say PB7, with 3 leds on PB0-PB2. And I can't spare port B since I am using the PIC16C61. If I use the interrupt on change feature and I change the state of one of the LEDs that would trigger the state change interrupt? Also an idea to prevent the ocassionaly miss of a switch. Just make sure the keys are well debounced with a small delay. The interrupt routine lasts perhaps for less than 1ms ( unless your code is huge), I don't know how many people can repeatedly press a button every millisecond. Neil Gandler