Brian Linari

Structs within Structs

Discussion created by Brian Linari on Jul 13, 2007
Latest reply on Jul 16, 2007 by Brian Linari

I am having a problem getting this to work.  I am Trying out this new thing ":1;"  It seems to be pretty cool when it works.
I find that sometimes it compiles just fine and breaks in simulator (not all the time). Other times the compiler gives me a warring and works just fine it also sometime doesn't work when it get a warring.

When is simulation mode I get this Error:
Error: Attempt to use uninitialized (uu) Accumulator.

This is the relivant code:


typedef struct status
{
    byte Mode0              :1;        /* b0 */
    byte Mode1              :1;        /* b1 */
    byte Mode_Read     :1;        /* b2 */
   
    byte High                  :1;        /* b5 */
    byte Active               :1;        /* b6 */
//    byte Master            :1;        /* b7 */
} Status;

typedef struct Port
{
//

int Period3;
Status Stat;
char Mode_out;
char Mode_in;    
char Clk_in;
char Clk_out;
char ModeRead;

} Port ;

void main(void)
{
Port Port1;
Port1.Stat.High=0;

while(1)
{
    Port1.Stat.High++;
}
}

Outcomes