Dear all, I want to access some continus bit,let me can modify the value,such as, for(i = 0 ; i < 10 ; i++) { bit[i] = ?; } but you know,the bit var cann't build as a array in keil c51,but build some boolean var with byte will speed down the MCU and more code,Who can give me a good advice and a way,Thanks in advance.
Hi, 1) Keil does support Bit-addressable Objects. Read all about bdata memory, bit type, sbit keyword. 2) you always are free to use ASM/ENDASM subroutines; 3) something like:
unsigned long bitfield, i; //32-bits array for(i = 0 ; i < 10 ; i++) { // set: bitfield |= 1<<i; // reset: bitfield &= ~(1<<i); // read state: (bitfield & 1<<i) }