Bit variables

Post your requests and ideas on the future development of mikroC for dsPIC30/33 and PIC24.
Post Reply
Author
Message
Daniel Wee
Posts: 38
Joined: 14 Jun 2007 22:05

Bit variables

#1 Post by Daniel Wee » 12 Feb 2009 20:03

Right now we can declare something like this:-

volatile struct {
unsigned char test1:1;
unsigned char test2:1;
unsigned char test3:1;
} myvar;

And we can then access it like this:-

myvar.test1 = 1;

But in the IAR compiler, you can do this:-

volatile struct {
unsigned char test1:1;
unsigned char test2:1;
unsigned char test3:1;
};

And you can access it like this:-

test1 = 1;

Similarly, in IAR you can do this:-

union {
ShiftReg;
struct {
unsigned char ShiftRegLSB :1;
unsigned char :1;
unsigned char :1;
unsigned char :1;
unsigned char :1;
unsigned char :1;
unsigned char :1;
unsigned char ShiftRegMSB :1;
};
};

And you can access it this way:-

ShiftReg = 0xFF;
ShiftRegLSB = 0;

Is it possible to have this feature in the new compiler?

Daniel

Post Reply

Return to “mikroC for dsPIC30/33 and PIC24 Wish List”