Bit shifting, again!
hey guys,
still learning here, , not great @ these bitwise operations. have protocol specifies data sent 2 bytes, 2 significant bits of byte reserved. is, 2 first bits must zero. 00111111 valid, 11111111 not.
that said, they're still 2-byte values. how spit out value given int? 4095, presume (12 bits total). want send 1000 example, 00000111 00101000. how do programmatically in code?
thanks!
still learning here, , not great @ these bitwise operations. have protocol specifies data sent 2 bytes, 2 significant bits of byte reserved. is, 2 first bits must zero. 00111111 valid, 11111111 not.
that said, they're still 2-byte values. how spit out value given int? 4095, presume (12 bits total). want send 1000 example, 00000111 00101000. how do programmatically in code?
thanks!
would this?
int = 1000;
int msb = a&0x0fc0 >> 6;
int lsb = a&0x003f;
or that?
thanks!
int = 1000;
int msb = a&0x0fc0 >> 6;
int lsb = a&0x003f;
or that?
thanks!
Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > Bit shifting, again!
arduino
Comments
Post a Comment