On Mon, 3 Dec 2001 15:43:05 -0500, you wrote: >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. >/\/\/\/*=3DMartin Hitech allows bit vars to be declared, and also to be assigned to fixed addresses for hardware, e.g.=20 static volatile bit GP5 @ (unsigned)&GPIO*8+5; GP5 =3D 1; generates BSF GPIO,5=20 Unfortunately you can't use the @ operator on vars whose address is not known at compile time, so this doesn't solve the original problem. >----- 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=3Dplatinum&refcd=3DPT97 >> >> -- >> 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