Help in create bitmask to i2c registry

Hi, im want create mask to enable LPF2 ( ODR_XL/400 )

But I can't create the bitmask correctly.



Thanks for help !

HPCF_XL[1:0] = 0b11

To enable:
High-pass filter: ODR_XL / 400
LPF2: ODR_XL / 400

I do: 0b10000001 | 0b11 | 0b11

is it correct?

No - why would you OR something twice, in the wrong two bits?
You need to shift your mask left before ORing.

You can give an example ? . I do not understand.

If you look at the description of the CTRL8_XL register (Section 9.19, Table 66), you'll see that HPCF_XL occupies bits 6 and 5 of the register.
So, your mask needs to be shifted left 5 bits.

(Caveat: I have never used this device)

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.