Scott Calvert

struct variable access

Discussion created by Scott Calvert on May 10, 2006
Latest reply on May 10, 2006 by UK_CF_FAE
I am using the following and can'y access the variable flags1.  I can only change bits
 
Also, the struct defaults to 2 byte.  I can't seem to change it to 1 byte.  I'm new to C.
 
Thanks,
 
 
struct
      {
       byte flow0              :1;     /* b0 */
       byte flow1              :1;     /* b1 */
       byte temp0              :1;     /* b2 */
       byte temp1              :1;     /* b3 */
       byte pres0              :1;     /* b4 */
       byte pres1              :1;     /* b5 */
       byte reverse            :1;     /* b6 */
       byte capfont            :1;     /* b7 */
       byte ampm24             :1;     /* b8 */
       byte h24                :1;     /* b9 */
       byte underline          :1;     /* b10 */
       byte volstd             :1;     /* b11 */
       byte pwrsav             :1;     /* b12 */
       byte baklit             :1;     /* b13 */
       byte mdyform            :1;     /* b14 */
       byte magnify            :1;     /* b15 */
      }
flags1;
#define flow0 flags1.flow0
#define flow1 flags1.flow1
#define temp0 flags1.temp0
#define temp1 flags1.temp1
#define reverse flags1.reverse
#define pres0 flags1.pres0
#define pres1 flags1.pres1
#define capfont flags1.capfont
#define ampm24 flags1.ampm24
#define h24 flags1.h24
#define underline flags1.underline
#define volstd flags1.volstd
#define pwrsav flags1.pwrsav
#define baklit flags1.baklit
#define mdyform flags1.mdyform
#define magnify flags1.magnify

Outcomes