On Sun, 19 Oct 1997 18:30:47, Andy Shaw wrote: > a) Explain exactly what the problems are with using this feature > when making changes to other bits in the device. The timing sequence on a read is: 1. latch the bits to be read 2. Input bit might change (about 1/4 of an instruction time) 3. latch the comparison value You can not directly read or write the comparison value. So if the bit changes at the wrong point in time, you won't know. It's a small window, so if missing an occasional change is ok, you can use it. On a keypad with some sort of user feedback, the user will try again when the system misses a keypress. So, if it doesn't happen very often, it won't be much of a problem. > b) What if any the hardware changes in devices like the 16c711 do > to this problem. Not sure. > c) Is there any recommended work around. I think this will work, if PortA 0:3 are available. I don't know if it is recommended, it's somewhat ugly. 1. Connect RB4 to RA0, RB5 to RA1, RB6 to RA2 and RB7 to RA3. Either: make sure the PIC never tries to drive to connected pins in opposite directions. Or: include series resistors, so that if 2 pins drive a signal in opposite directions, you don't exceed 20 milliamps (>250 ohms at 5 volts). 2. After each read of PortB, read PortA. If the value is different, do the interrupt on PortB action. Note: calling or jumping directly into the interrupt routine may not work well, if the interrupt routine assumes that interrupts are disabled. Likewise, restoring registers that weren't saved and doing a Retfie might be bad. [If the input value isn't real clean, sample Port A multiple times. If it is really ugly, add an external buffer.] > Andy Paul (not an Andy, am I still allowed to post?) Haas -- paulh@hamjudo.com http://www.hamjudo.com