Jump to content

Bit Access For 16 Bit Variables / Structs

Recommended Posts

bit access is pretty neat, but it doesn't appear to be supported for 16 bit variables.


it seems it would be really easy to add support for this in the compiler.


The other thing is that from what I see the compiler only supports integers, and not a variable.


i.e., this is supported: PORTC.1


but this isn't: PORTC.foo


it would also be nice if the set_bit + clear_bit routines would be enhanced to work in the same way. Perhaps the compiler could default to masking for 16bit variables.


i.e. setting would be PORTC |= var_MASK;

and clearing: PORTC &= ~var_MASK;


the other thing is do you guys support > 8bit bit-fields?




struct packed_struct {

unsigned int f1:1;

unsigned int f2:1;

unsigned int f3:1;

unsigned int f4:1;

unsigned int type:4;

unsigned int funny_int:9;

} pack;



THAT would be VERY useful! And savea whole mess of code-space.

Link to post
Share on other sites

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...