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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/29/03 20:29
Read: times


 
#55730 - RE: Hardware query on interrupt
Responding to: ???'s previous message
You could also do things a little bit different and get rid of the AND gate or diodes entirely.

Since you have to debounce the signal to the interrupt pin, using your scheme, I would instead dispense with the ideal of using the external interrupt completely. Instead make an interal timer interrupt that interrupts at a regular rate of say once each 5 milliseconds. Then at the interrupt time sample the four port input pins. With the proper program logic you can both debounce the switch inputs and detect when there is a state change in any switch. This has an additional benefit that you can detect the switches on both the make and the break and measure out the duration of a switch being held down.

A while ago I posted a software routine that worked much like I am describe above. That was in this posting: http://www.8052.com/forum/read.phtml?id=31164

That sample code actually scanned a 4x5 matrix of keys. Maybe you could modify that code to just scan one row (think of your switches as a 1 x 4 matrix).

For a more general solution I published a piece of code that filtered and detected a series of switch type inputs via a software state machine. You may want to look at that code because it may be more applicable to what you intend. You can see the state machine code in this posting: http://www.8052.com/forum/read.phtml?id=47505

Michael Karas




List of 10 messages in thread
TopicAuthorDate
Hardware query on interrupt            01/01/70 00:00      
   RE: Hardware query on interrupt            01/01/70 00:00      
   RE: Hardware query on interrupt            01/01/70 00:00      
      RE: Hardware query on interrupt            01/01/70 00:00      
         RE: Hardware query on interrupt            01/01/70 00:00      
            RE: Hardware query on interrupt            01/01/70 00:00      
               RE: Hardware query on interrupt            01/01/70 00:00      
                  RE: Hardware query on interrupt            01/01/70 00:00      
                     RE: Hardware query on interrupt            01/01/70 00:00      
                        RE: Hardware query on interrupt            01/01/70 00:00      

Back to Subject List