Is there a way to make a bitfield structure for K22 in KDS?
Hello Macro
I tested in KDS 3.0 and defined the bitfield structure as below:
union {
unsigned char bits;
struct {
unsigned char bit0 : 1;
unsigned char bit1 : 1;
unsigned char bit2 : 1;
unsigned char bit3 : 1;
unsigned char bit4 : 1;
unsigned char bit5 : 1;
unsigned char bit6 : 1;
unsigned char bit7 : 1;
}R;
} Test_bit;
And access it in code as:
Test_bit.R.bit7=1;
This works as on other C compiler.
Best Regards
Fiona Kuang
Technical Information & Commercial Support
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Mark Correct button. Thank you!
-----------------------------------------------------------------------------------------------------------------------
What are the resulting assembly-level instructions for the C-source 'Test_bit.R.bit7=1;'? I.e., what is the code-cost for packing density?