Normal C has bitfields in it. Usually you use them in structs or unions. Problem is you don't usually know which bit is assigned, so I prefer assembly at that level of detail. /\/\/\/*=Martin ----- Original Message ----- From: "Sean H. Breheny" To: Sent: Monday, December 03, 2001 3:27 PM Subject: Re: [pic]:Accessing a var as a byte or bits in C > Hi Andrew, > > Is this specific to HiTech? I have never seen a "normal" C compiler which > had a bit variable type, and I thought that either the ANSI or K&R > standards did not call for such a type. > > Sean > > At 11:31 AM 12/3/01 -0700, you wrote: > >Re: > > > >>In Hitech C, is it possible to access the same variable as two > >>different types in C, specifically bits and bytes ? > >>For example I want some bit variables for various option flags, but > >>want to access them all as a single byte when saving/loading them to > >>eeprom. > >> > >>Can unions be used to do this ? > > > > > >Yes. > >-- > > > > ______________________________________ > > Andrew E. Kalman, Ph.D. aek@pumpkininc.com > > > >-- > >http://www.piclist.com hint: PICList Posts must start with ONE topic: > >[PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > > > ---------------------------------------------------- > Sign Up for NetZero Platinum Today > Only $9.95 per month! > http://my.netzero.net/s/signup?r=platinum&refcd=PT97 > > -- > http://www.piclist.com hint: PICList Posts must start with ONE topic: > [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads > > -- http://www.piclist.com hint: PICList Posts must start with ONE topic: [PIC]:,[SX]:,[AVR]: ->uP ONLY! [EE]:,[OT]: ->Other [BUY]:,[AD]: ->Ads