Hi Martin, > Interesting idea, I think in this case the table lookup would be the > preferable way to go (no real memory constraints and constant time, but I > think I'll keep a binary tree comparison in mind for possible future use. > Always more than one way to skin a cat… Thanks again. Yeah - if the states values are "dense" (i.e. values like 0, 1, 2, 3, 4, ...) then the lookup table will be faster and take up less memory. If you're implementing something where the states are "sparse" (i.e. values like 1, 17, 23, 24, 51) then using the binary search method would be better. From your other email: > It's been a while since I did a complete read through the data sheet, I > just looked through the instruction set reference and missed IJUMP. > I guess I need to take a vacation… Thanks again. My usual method of implementing something like lookup tables in assembler when I'm unfamiliar with the assembler (I can barely claim to know any AVR assembler) is to code it in C (which I know) and look at the compiler generated output. -- Dave Hylands Vancouver, BC, Canada http://www.DaveHylands.com/
Message
Re: [AVR-Chat]
2005-10-27 by Dave Hylands
Attachments
- No local attachments were found for this message.