hi I'm using AVR codevision after defining 16 bit variable codevision shows this error :
too many global/static 'bit' variables
Does bit variables are limited in AVR?or they are just limited in codevision?or it's something else?
My guess would be codevision as the avr doesn't care if you access all the available ram as bits. How many do you have?
Is codevision similar to C and can you have a Union?
All I know is... Pic assembly only allows bit access to a few ram locations... AVR may be the same... If your compiler is the GNU derivative ( I think it is )
You can do this ( as Mike suggested )
C:
struct BITACCESS{
unsigned A : 1;
unsigned B : 1;
unsigned C : 1;
unsigned D : 1;
unsigned E : 1;
} flags;
flags.A = x;
Otherwise the compiler WILL use the hardware version.. On the pic's there is only 16 or so locations...
**NOTE** I may be talking about older ( smaller) pics..... I know 8051 does this.. I'm sure I read somewhere that pics do this aswell
BUT!! I cannot substantiate .. Take with pinch of salt!
All I know is... Pic assembly only allows bit access to a few ram locations... AVR may be the same... If your compiler is the GNU derivative ( I think it is )
The 14 bit assembler bit based routines use 7 bit addressing, so will address 128 bytes per memory bank - with (often) the lower 32 as SFR, and the top 16 RAM locations common across all banks. So about a maximum of 80 bytes per bank, plus the 16 common ones.
Are you perhaps thinking of the common 16 bytes?, and if so is that perhaps a limitation of the C compiler?.
The 14 bit assembler bit based routines use 7 bit addressing, so will address 128 bytes per memory bank - with (often) the lower 32 as SFR, and the top 16 RAM locations common across all banks. So about a maximum of 80 bytes per bank, plus the 16 common ones.
Are you perhaps thinking of the common 16 bytes?, and if so is that perhaps a limitation of the C compiler?.
Yeah! scrambling to find where I read it... I definitely know the 8051 does, I thought I read somewhere that because of banking the bit access was restricted to lower bank... But that probably ony happened way back.. I did used to use the old 12f508..
Yeah! scrambling to find where I read it... I definitely know the 8051 does, I thought I read somewhere that because of banking the bit access was restricted to lower bank... But that probably ony happened way back.. I did used to use the old 12f508..
I used the 12F208 for a number of projects way back and can confirm there were no restrictions on using the 25 ( ) bytes of memory - however, I was in assembly then.
I used the 12F208 for a number of projects way back and can confirm there were no restrictions on using the 25 ( ) bytes of memory - however, I was in assembly then.
You forget how it used to be - the 18F27K42 I'm playing with a lot now has 128KB of 'ROM' and 8KB of 'RAM', and the 16F18857 I also use has 32KB and 4KB. Even my current 8 pin of choice (the 16F18313) has 3.5KB and 256 bytes, or the 12F1840 has 4KB and 256 bytes.