| ??? 02/17/03 10:47 Read: times |
#39230 - RE: PCF8574 + switches Responding to: ???'s previous message |
Peter:
I would not use the PCF8574 in the manner that you describe.....just ignoring for a moment that problems you are having. The reason I would discourage its use is that in general one likes to keep the processing time in the interrupt routine as short as possible. If you are spending the time to read this chip via I2C (bit banged or otherwise) then your time in the interrupt will be a long time. (Bit banged I2C that I have made before can take a couple of milliseconds to read a byte). On top of that proper reading of switches will require that you read the switch states multiple times to ensure that when a switch is pressed it stays in the pressed state for at least a debounce period. (The PCF8574 is not going to show the interrupt on its output if the switch stays static/pressed for say like 10 msec debounce period. Thus you still need to incorporate some type of timer logic to incorporate a valid debounce interval. You also mentioned that you have 28 switches. Do you have these organized into a row/column matrix to save I/O pins? You can make a 7x4 matrix and get the job done with 11 I/O lines. It has been my experience that using interrupts to directly detect switch presses is not a good way to go about things. Also I would arrange a much faster way to access the I/Os for the switches, if this means using a 8-bit parallel buffer or a shift register chip like HC165. The shift register is better for I/O expansion becasue the software can clock it much faster than I2C. Lastly one other thing to consider. If you have multiple I2C devices in a system all on the same bus such as serial EEPROM and PCF8574 then if you try to access the PCF8574 in an interrupt routine you have to make sure that the mainline code is not being interrupted out of the routine that does the read/write of the serial EEPROM. You would have to disable the interrupts for the duration of time that the serial EEPROM access was in process. (Just something to think about as this may not be an optimum system design). Michael Karas |
| Topic | Author | Date |
| PCF8574 + switches | 01/01/70 00:00 | |
| RE: PCF8574 + switches | 01/01/70 00:00 | |
| RE: PCF8574 + switches | 01/01/70 00:00 | |
| RE: PCF8574 + switches | 01/01/70 00:00 | |
| RE: PCF8574 + switches | 01/01/70 00:00 | |
| RE: PCF8574 + switches | 01/01/70 00:00 | |
| RE: PCF8574 + switches | 01/01/70 00:00 | |
| RE: PCF8574 + switches | 01/01/70 00:00 | |
| RE: PCF8574 + switches | 01/01/70 00:00 | |
| RE: PCF8574 + switches | 01/01/70 00:00 | |
RE: PCF8574 + switches | 01/01/70 00:00 |



