|
-
June 5th, 2012, 12:50 AM
#1
Bitfiields in C how to?
Hi,
I pasted my problem (below), need solution for the same
/* Counting bits from left to right (least significant bit is bit 0 and
* most significant is bit 31), the following describes the encoding pattern.
* All values can be assumed to be integers for simplicity
*
* bit 7 to bit 0 : (8 bits) represent the temperature
* bit 8, 9, 10 : UNUSED
* bit 17 to bit 11 : (7 bits) represent the humidity
* bit 18 : UNUSED
* bit 22 to bit 19 : (4 bits) represent the rainfall in inches
*/
I have a (below) function which will return int valve containing all the above senser values in it.
int getSensor() {
return 2543133;
}
Using bitfields how to process this and get correct values?
can anybody help me please!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|