Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
10/27/04 18:45
Read: times


 
Msg Score: +1
 +1 Good Answer/Helpful
#79897 - RE: PCF8574 matrix keyboard
Responding to: ???'s previous message
I don't know if using an interrupt is so stupid. It depends on what you want to do.

I'm currently developing a system that uses a keyboard, also connected to the IO pins of a PCF8574 (Philips, but that shouldn't matter).
Next to detecting a keypress, I also want to know how long a key is pressed, since pressing a certain key for a longer time will result in another behavior.

I'm still experimenting, but I want to know as soon as possible when one of the inputs of the IO expander has changed. This info is given to me by means of the interrupt pin.
Then I'm reading the status of the IO expander via I2C and I'm starting a timer (in fact, first starting a timer...). When the timer elapses and I didn't get a new interrupt indicating the key might have been released, I'm checking again the state of the IO expander.

If that key is still pressed, then I know the alternative functionality of the key is expected. You can even connect more of those different functions to one key, depending on the time a key has pressed.

For instance, pressing it no longer than 0.5 sec will just switch on or off the light. Pressing it more than 2 seconds will select another group of lights and pressing it more than 5 seconds will start dimming the light (this is an example, of course...).

Without using the interrupt, you have to start polling. This is ok if the system is not heavily loaded, but might give a problem when it is...

Therefore, I shouldn't throw away immediately the use of an interrupt...

-- Geert

List of 10 messages in thread
TopicAuthorDate
PCF8574 matrix keyboard            01/01/70 00:00      
   RE: PCF8574 matrix keyboard            01/01/70 00:00      
   RE: PCF8574 matrix keyboard            01/01/70 00:00      
      RE: PCF8574 matrix keyboard            01/01/70 00:00      
      RE: PCF8574 matrix keyboard            01/01/70 00:00      
         RE: PCF8574 matrix keyboard            01/01/70 00:00      
         RE: PCF8574 matrix keyboard            01/01/70 00:00      
            RE: PCF8574 matrix keyboard            01/01/70 00:00      
                RE: PCF8574 matrix keyboard            01/01/70 00:00      
            RE: PCF8574 matrix keyboard            01/01/70 00:00      

Back to Subject List