Part Number: CC3200
Tool/software: TI C/C++ Compiler
Hello,
I created bit array and trying to access individual bits. But This compiler is not allow to access bit from that memory address of Bit array.
Please verify and let me know if anything wrong. Same code i ran in GCC compiler it worked but not in Ti compiler.
#define ARRAY_SIZE(x) (x/8+(!!(x%8)))
unsigned char array[1], ulData[1]={0};
unsigned char CoilReg[ARRAY_SIZE(8)];
void Status(unsigned char *ulData)
{
int i;
for(i=0; i <= 8 ; i++)
{
if(CoilReg[i] ==0)
{
ulData[1+((i)/8)] &= ~( 1 << (i % 8)) ;
}
else
{
ulData[1+(i/8)] |= ( 1 << (i% 8));
}
//printf( "coil Status : %d\n", CoilReg[i] );
//printf( "Individual Status : %d\n", ulData[i/8] );
}
printf( "Sizeof( Array ) : %d\n", ulData[1] );
//printf( "coil Status : %d\n", CoilReg[ARRAY_SIZE(8)]);
}
int main( ) {
unsigned char Bitstatus, Temp[1];
//printf( "Sizeof( Array ) : %d\n", sizeof(array) );
array[0] = 0x0A;
Status(Temp);
}