Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
03/20/02 11:30
Read: times


 
#21016 - RE: bit array in C (for 8051)
You could make it into an array by calling a function which will shift a bit to the correct location, then ANDing it to test it, then returning TRUE/FALSE like this :-


byte GetAt(byte data,byte idx)
{

return ( data & (1<<idx));
}

then use :-

byte MyData=54;

for(i=0;i<8;i++)
{
if(GetAt(MyData,i))
{
printf("Bit %d was SETn",i);
}
else
{
printf("Bit %d was CLEARn",i);
}
}


It isn't efficient. but it will work.

Chris.

List of 14 messages in thread
TopicAuthorDate
bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051)            01/01/70 00:00      
RE: bit array in C (for 8051) - Kapil            01/01/70 00:00      
Bit pointers in C51            01/01/70 00:00      

Back to Subject List