Ross Myers

Counting key presses concept - 68908GZ8

Discussion created by Ross Myers on Mar 22, 2009
Latest reply on Mar 22, 2009 by bigmac

Hi All,


Just working on a little something for home where I want to be able to control two relays to switch on some lights in a mode dependent on the number of key presses from one single button.

Relay 1 controls some front lights, Relay 2 controls some side lights.


The CPU I am using is a 68908GZ8 and I prefer assembler if someone wanted to post some example code :smileyhappy:


So what I want to do is something like this -

A) - If the lights are off, one key press turns Relay 1 on.

B) - If the lights are off, two key presses turns Relay 1 & 2 on.

C) - If either light is on, one key press turns both Relays off.


Couple of questions, would using the Keyboard Module be necessary? Is the only way to do this by using timers and checking for 'x' time between key presses?

Obviously there would also need to be a time out function from A to skiping B and waiting for C.


Any advice on which path to head down would be appreciated.




Message Edited by Bloodhound on 2009-03-22 11:21 PM
Added p/n to subject.
Message Edited by NLFSJ on 2009-03-26 04:11 PM