100bit array in codevision

Status
Not open for further replies.

maia31

New Member
i want build fifo
so i define an array
a[100]
but i dont the type of my aaray?
because the max bit support in codevision is for type long int and it is 64 bit not 100 bit
so what should i do?
 
volatile bit a[100];
doesn't work.
You can create a Byte Array with.
volatile char a[13];
So you get an Array with can contain 104Bits

To Adress the Byte you have to divide it by 8.
byte = bitcount/8;
To get the Bit in that Array you should use the Rest Function
bit = bitcount%8;

byte=bitcount/8;
xbit=bitcount%8;
if(a[byte]&&(1<<xbit)>0)
{
result=1; //The Adressed Bit was 1
}
else
{
result=0; //The Addresed Bit was 0
}

I've not tested yet, but i think it will be work.
 
Last edited:
Update:
I've tested with AVR Studio Simulator.
That routine works!
Code:
// Declare your local variables here
volatile unsigned char a[13];    //104 Bits
volatile unsigned char byte,xbit,result; //Helper Variables
volatile unsigned char bitcount=67;  //Adressed Bit
....

....
byte=bitcount/8;
 xbit=bitcount%8;
 if((a[byte]&(1<<xbit))==0)
    {
    result=0;
    }
 else
    {
    result=1;
    }
 };
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…