Hi all, I'm trying to define a status register in XC8. I'd like to be able to reference individual bits, but also be able to say, clear the variable as a whole. I currently have it defined as this: typedef union { struct { unsigned ENC1UP :1; unsigned ENC1DN :1; unsigned ENC2UP :1; unsigned ENC2DN :1; unsigned ENC3UP :1; unsigned ENC3DN :1; unsigned ENC4UP :1; unsigned ENC4DN :1; }; struct { unsigned :8; }; } EncStatus_t; In another part of the code, I define a variable using the typedef EncStatu= s_t. In my code, I have two lines that try to write to that variable: EncStatus.ENC1DN =3D 1; EncStatus =3D 0; // Clear encoder status register The first line works perfect. The second line throws an error though - illegal conversion between types - int -> volatile union. I understand the basic problem here, but I can't seem to fix it. I've spent a bunch of time looking at the header file for my processor, to see how I can write to both PORTB and PORTBbits.RB0 successfully. Near as I can tell, it's because both of those variables are explicitly being declared at the same address, not because there's anything fancy in the union. So...is there a way to deal with this when I don't know where the variable will be assigned? To be clear, this isn't a work stopping problem, I'd just like to know if there's a way to do this that is efficient. After all, I can always just clear each bit individually. Thanks! Josh --=20 A common mistake that people make when trying to design something completely foolproof is to underestimate the ingenuity of complete fools. -Douglas Adams --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .