Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
09/11/12 04:16
Read: times


 
#188303 - just want to check...
Responding to: ???'s previous message
Per Westermark,

i just want to know is it possible or not?

multiple variable bit convert into single variable so its simple to check and to modify,

here this is stucture of variable(unsigned char), we can access individule bits of that variable.

/*********************************/
typedef unsigned char byte;

typedef union {
struct {
byte bit0 :1;
byte bit1 :1;
byte bit2 :1;
byte bit3 :1;
byte bit4 :1;
byte bit5 :1;
byte bit6 :1;
byte bit7 :1;
} Bits;
} check_flags;

check_flags _flag;
#define flag _flag.Byte
#define bit0 _flag.Bits.bit0
#define bit1 _flag.Bits.bit1
#define bit2 _flag.Bits.bit2
#define bit3 _flag.Bits.bit3
#define bit4 _flag.Bits.bit4
#define bit5 _flag.Bits.bit5
#define bit6 _flag.Bits.bit6
#define bit7 _flag.Bits.bit7
/*************************************/
byte addressable, its convert into bit addressable
if have 3 variable like this, merging individule bit into single variable.......

i gave example of interrupt, but it might be anything.
advantage is i can deal with 1 variable instand of 3 variable.

List of 11 messages in thread
TopicAuthorDate
Different variable bit merge into single variable?            01/01/70 00:00      
   Of course            01/01/70 00:00      
      its bit addressable....            01/01/70 00:00      
         No            01/01/70 00:00      
            just want to check...            01/01/70 00:00      
               What was missing in the answers you have already received?            01/01/70 00:00      
                  no defined bit order            01/01/70 00:00      
                     Just use C expression            01/01/70 00:00      
         what is wrong with IE?            01/01/70 00:00      
            Right!!!!!!!!!!            01/01/70 00:00      
               gobbledygook            01/01/70 00:00      

Back to Subject List