Binary notation, is sometimes handy while writing a code to access a register where each bit to a property.
A simply solution:
const byte b00000000 = 0x00; const byte b00000001 = 0x01; const byte b00000010 = 0x02; const byte b00000011 = 0x03; const byte b00000100 = 0x04; ....Attachments file for all value;
Use For exemple to circuit test (use class b)..
i2c_gyro.Write((byte) register.CTRL_REG1, b.b00001111); // Turn on XYZ axes // Bit 7, 6: Output Data Rate Selection [100Hz, 200Hz, 400Hz, 800Hz] // Bit 5, 4: Bandwidht selection [12.5 To 110 fonction ODR selection] // Bit 3: Power Down if 0 // Bit 2: Z Axis Enable // Bit 1: Y Axis Enable // Bit 0: X Axis Enable
it' équivalent to:
i2c_gyro.Write((byte) register.CTRL_REG1, (byte) 0x0F); // Turn on XYZ axes
Thierry
Attached Files
- st3mcg likes this