This thread has been locked.
If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.
Hello,
Is there a way to be able to extract bit-wise data from a Uint16 variable? When viewing the Uint16 in the Expressions window in CCS, I can see the binary representation, but is there a way to be able to access individual bits in the code (for example to access the 3rd bit)?
I could write my own function for converting from a Uint16 to binary, but I imagine there's some easier way to do this.
Thanks,
Kevin
Hello Kevin,
Because the C28x device uses a 16-bit word, there is no intrinsic way to extract just a single bit via hardware. The reason bitfields are possible is because of the library support for them in C2000Ware, however there is no similar support for normal integer variables. If you want to have the ability to extract specific bits from uint16_t variables I believe you will need to create your own functions, but I will let a compiler expert confirm this.
Best regards,
Omer Amir
Omer,
Thanks for your reply. Could you clarify what you mean by "The reason bitfields are possible is because of the library support for them in C2000Ware". Is there a library function in C2000Ware I can use for extracting bits?
Thanks,
Kevin
Hi Kevin,
Is there a library function in C2000Ware I can use for extracting bits?
This only applies to peripherals on the device, not integers (this uses structs to delineate the bit values, but they are all still Uint16 data types). You can look in the C2000Ware_5_00_00_00\device_support\f28p65x\headers\include directory in C2000Ware for more info.
Best regards,
Omer Amir