3 posts / 0 new
Last post
hssmltd
Offline
Last seen:6 months 2 weeks ago
Joined:2015-09-05 08:29
access single bits

Hi,
I need to modify a variable bit by bit.
How can i address specific bit in a int variable?

Best regards,
hssm

Device:
MT_dialog
Offline
Last seen:1 month 4 weeks ago
Staff
Joined:2015-06-08 11:34
Hi hssmltd,

Hi hssmltd,

You can use a 0x01 value and shift it as many times as the bit you want to access and then invert it, that way you can create a mask and change the value with the proper operator. You can find some examples for doing these kind of operations in the macro in the datasheet.h file in the SDK.

Thanks MT_dialog

hssmltd
Offline
Last seen:6 months 2 weeks ago
Joined:2015-09-05 08:29
Thanks!

Thanks!

Topic locked