Workinonit:
So I want to examine a byte of data and inspect the individual bits to see if they are on.I know that I can do something like
for(byte i=0;i<8;i++)
{ if (data & (1<<i))
do blah;
}
What I am however this seems like a lot of code to do such a simple thing. Where does the bit go that is shifted out of the byte? Does it go into overflow? I would think you could do soemthing like **Using C++ what happens on certain shift operations depends on if the variable is a signed or unsigned type (http://arduino.cc/en/Reference/Bitshift) If one is programming in AVR assembly language then you do have access to a carry and/or overflow bit that is effected by certain machine language shift and rotate instructions.** **Lefty**for(byte i=0;i<8;i++)
{ data >>=1;
if(overflow) {
do blah;
}
}I am trying serially write to a pin and don't wish to use SPI. Speed is super important to keep the data rate as high as possible, thus, I am trying to do it with the least number of instructions. Any help is much appreciated... As always... Workinonit!