Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: [AVR-Chat]

2005-10-27 by Dave Hylands

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/

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.