| ??? 06/26/00 20:58 Read: times |
#3422 - RE: Keypad issues |
Of course, the 8051 has a multiply command but lacking that here is a faster way to multiply by ten:
N * 10 = ( N * 2 ) + ( N * 8 ) N * 10 = ( N * 2 ) + ( N * 2 ) * 4 A binary shift left with zero insertion into the lsbit is the same thing as a multiplication by 2. Repeated shifts can multiply by powers of 2. Using this trick you can often decompose a formula into powers of two and perform with shifts and additions. PROCESS: So all you would do is take N, shift it left once with zero loading into the lsbit to get the value (N*2). Save a copy in another register temporarily, and shift the (n*2) left twice more to get (N*8). Now add the saved value (N*2) to the current value (N*8) and you have (N*10). Decomposing mathemathics is great fun! -Jay C. Box |
| Topic | Author | Date |
| Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| Debouncing Keypads | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| RE: Keypad issues | 01/01/70 00:00 | |
| Keypad issues | 01/01/70 00:00 | |
RE: Debounced switch | 01/01/70 00:00 |



