??? 01/16/11 14:56 Read: times |
#180634 - Table or nested loops Responding to: ???'s previous message |
Two alternatives.
The simple alternative is to create a table with one byte for each state the LEDS can have. 0x00 - all LED off 0x80 - one LED at top lit. 0x40 - have moved one step. 0x20 - two steps dow 0x10 0x08 0x04 0x02 0x01 - first LED have reached bottom of hour glass 0x81 - new LED starting path down 0x41 - one step down 0x21 .. 0xFF - all 8 LED lit - time to start emptying it again ... The next alternative is that you look at the above and see how you can convert it into loops. When filling the display, you loop through # numbers of LED. And an inner loop that moves the new LED down while there is space to move it one step further down. When the LED reaches the end (after 8 steps) or next LED position is already lit, then it's time to exit the inner loop and have the outher loop start with a new LED. Nothing hard. But you must spend time trying to design the loops. It may be easier to do in C than in assembler. Or if you must have an assembler solution, you could prototype the solution in C and then rewrite in assembler when you have figured out what the loops are expected to do. |
Topic | Author | Date |
Help Help Codes for 8 LEDs Sand Watch in ASSEMBLY | 01/01/70 00:00 | |
Hourglass? | 01/01/70 00:00 | |
8 LEDs sand watch | 01/01/70 00:00 | |
Table or nested loops | 01/01/70 00:00 | |
Didn't you just repeat exactly the same post? | 01/01/70 00:00 | |
possible approach | 01/01/70 00:00 | |
LED Patterns | 01/01/70 00:00 | |
Using spreadsheets | 01/01/70 00:00 | |
Further -- Consider | 01/01/70 00:00 | |
Cart before horse | 01/01/70 00:00 | |
What does AND and OR? | 01/01/70 00:00 | |
last time I looked 89S52 had 8 kByte flash, ASSEMBLY? | 01/01/70 00:00 | |
First Cycle Compete | 01/01/70 00:00 | |
How to post legible source code | 01/01/70 00:00 | |
algorithm, assembler | 01/01/70 00:00 | |
Thanks for the help and support | 01/01/70 00:00 |