| ??? 03/23/10 03:21 Read: times Msg Score: +1 +1 Good Answer/Helpful |
#174412 - Syntax and strategy problem. Responding to: ???'s previous message |
Every outer item in your union is on top of each other.
Try something more like this:
/* define structure of RTC register layout */
struct CAL_DATA
{
unsigned char min;
unsigned char hours;
unsigned char date;
unsigned char mon;
unsigned char year;
unsigned char ctl;
};
/* define the union to overlay array and register structure */
union CAL_OVERLAY
{
unsigned char cal_ary[sizeof(CAL_DATA)];
struct CAL_DATA cal_reg;
};
/* declare an instance of the union as global variable */
union CAL_OVERLAY cal;
Note I rarely if ever use TYPEDEF in C. It make proofing code for design reviews overly complicated. Michael Karas |



