??? 06/27/06 03:57 Read: times |
#119166 - Spot on. Responding to: ???'s previous message |
Been using a similar algorithm for quite some time for byte-wide key reads. I generally use 30mS debounce as some switches can be pretty noisy. You can expand this width wise and gather byte(s) from a switch matrix if required. Detect either the break edges by inverting the data read.
In P-code it looks like the following, called every 30mS: Sample_new = Read_port Edges = Sample_old xor Sample_new Make_edges = Edges and Sample_new Sample_old = Sample_new Action_flags = Action_flags or Make_edges in assembler: mov a, Px mov Sample_new, a xrl a, Sample_old anl a, Sample_new mov Sample_old, Sample_new orl Action_flags, a You can then use jbc on Action_flags bits, assuming you have assigned it a bit-mapped register. Make sure to initialise Sample_old at startup with: Sample_old = Read_port and of course Action_flags = 0 |
Topic | Author | Date |
Multiple switch debouncing | 01/01/70 00:00 | |
Otherways | 01/01/70 00:00 | |
Vertical counters | 01/01/70 00:00 | |
vertical conters in C | 01/01/70 00:00 | |
and here | 01/01/70 00:00 | |
vertical counter with press detection | 01/01/70 00:00 | |
debounce and denoise needed | 01/01/70 00:00 | |
You are right of course, but... | 01/01/70 00:00 | |
Reminds me... (off topic) | 01/01/70 00:00 | |
XRL P2,A | 01/01/70 00:00 | |
some hair-splitting | 01/01/70 00:00 | |
exchange | 01/01/70 00:00 | |
thanx Kai ... | 01/01/70 00:00 | |
my way | 01/01/70 00:00 | |
exactly! | 01/01/70 00:00 | |
Spot on. | 01/01/70 00:00 | |
Two samples enough? | 01/01/70 00:00 | |
varies with design | 01/01/70 00:00 | |
Conditional executing versus branching | 01/01/70 00:00 | |
KEY RELEASE SUBROUTINE ... | 01/01/70 00:00 | |
Not really... | 01/01/70 00:00 | |
a TOTAL misconception or -very annoying | 01/01/70 00:00 | |
He does not | 01/01/70 00:00 | |
Beer o'clock | 01/01/70 00:00 | |
Yes, good idea | 01/01/70 00:00 | |
never did, never will | 01/01/70 00:00 | |
Agree![]() | 01/01/70 00:00 |