I'm using an array of ints in the bit addressable memory area as a crude bit array bdata unsigned int sample_window[SAMPLE_WINDOW_LENGTH]; //bit addressable array in bit memory I'm using a mask to read from the array, however when I try to write a new bit in using the mask and a bitwise ex-or bits in more than one byte get changed. sample_window[byte] = ((sample_window[byte]) ^ mask); //change location by bit exor any ideas on a better implementation?
You might wish to review this thread on bit arrays (or lack thereof): http://www.8052.com/forum/read.phtml?id=20996&top=21134 "I try to write a new bit in using the mask and a bitwise ex-or bits in more than one byte get changed." Of course it does: you have asked the compiler to do a bitwise XOR of two ints If you want to access individual bits, you need to use Keil's bit-addressing extensions: see the section Bit-addressable Objects in the manual (chapter 3, Language Extensions) Been there, done that, got the T-Shirt: http://www.thinkgeek.com/stuff/apparel/3239.shtml [prejudice] I do hate comments which come after the code which they describe! [/prejudice]