We are running a survey to help us improve the experience for all of our members. If you see the survey appear, please take the time to tell us about your experience if you can.
I am using the SPI to access a couple of 20 & 24 bit A/D converters which have some digital status bits preceding the reading. I already have some C code written (for another CPU) that defines the incoming data structure as a unsigned long. The Keil compiler, however, says I must use char or integer size bit fields. Is there an easy way around this without having to hand code the byte manipulation code manually?
Here is a simplified example.
typedef struct { unsigned long det_in :4, /*compliance & short detection bits */ Brd_rev :4, /* board / pal revision */ nu :4, /* not used as of 8/2000 */ AD_data :20; /* 0=-max, 0x80000=0v, fffff=+max */ } Bridge_brd_Rx_Type; /* for each bridge card */
{ long reading; char revision; reading = Brdg1.AD_data; revision = Brdg1.Brd_rev; ... }