8 bit enum, in C

Posted by oxinabox.ucc.asn.au on Stack Overflow See other posts from Stack Overflow or by oxinabox.ucc.asn.au
Published on 2009-11-09T06:38:27Z Indexed on 2010/04/04 20:53 UTC
Read the original article Hit count: 575

Filed under:
|
|
|
|

I have to store instuctions, commands that I will be receiving via serial. The commands will be 8 bits long.

I'd like to use Enumerations to deal with them in my code. Only a enumeration corresponds to a ... on this platform I think a 16 bit integer.

I need to preserve transparancy between command name, and its value. So as to avoid having to translate an 8-bit number received in serial into any type.

BTW the platform is AVR ATmega169V microcontroller, on the Butterfly demo board. It may be being underclocked to preserve power (I'm opposed to this, I believe the ATmega169V uses no power, not next to a router. But that's getting offtopic.) So I need to keep things fast, and I don't have any luxuries like file I/O. Or operating systems.

So any suggestions as to what type I should be using to store 8-bit commands?
There has got to be something better than a massive header of #defines.

© Stack Overflow or respective owner

Related posts about c

    Related posts about avr