ADXL375 maximum polling rate
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- richpaul6806
- Posts: 16
- Joined: Sun May 21, 2023 12:39 am
Re: ADXL375 maximum polling rate
I am reading the bits from starting at D0-D3 going from right to left but writing them from D3-D0 going left to right
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: ADXL375 maximum polling rate
Your program is reading the 4 bits in the same order as you wrote them. But you are writing just the low-order 4 bits of the register and then reading back and printing the entire 8 bit register.
The low order 4 bits are just what you wrote: 1101 == 0xD == 13
The high order 4 bits are all zero. So you are reading back: 00001101 == 0x0D == 13
The low order 4 bits are just what you wrote: 1101 == 0xD == 13
The high order 4 bits are all zero. So you are reading back: 00001101 == 0x0D == 13
- richpaul6806
- Posts: 16
- Joined: Sun May 21, 2023 12:39 am
Re: ADXL375 maximum polling rate
isnt the code RWBits(4, rate_register, 0) telling the program to start at bit 0 and write the next 4 bits(right to left)?
- adafruit_support_bill
- Posts: 88096
- Joined: Sat Feb 07, 2009 10:11 am
Re: ADXL375 maximum polling rate
It is defining a 4-bit wide field with the low-order bit at position 0.
https://docs.circuitpython.org/projects ... t/api.html
https://docs.circuitpython.org/projects ... t/api.html
Parameters
:
num_bits (int) – The number of bits in the field.
register_address (int) – The register address to read the bit from
lowest_bit (int) – The lowest bits index within the byte at register_address
register_width (int) – The number of bytes in the register. Defaults to 1.
lsb_first (bool) – Is the first byte we read from I2C the LSB? Defaults to true
signed (bool) – If True, the value is a “two’s complement” signed value. If False, it is unsigned.
- richpaul6806
- Posts: 16
- Joined: Sun May 21, 2023 12:39 am
Re: ADXL375 maximum polling rate
Ah ok. So it is counting right to left to get the block, but once the block is set we read and write left to right. Seems like a backwards way of organizing everything but I'm sure there is some higher level reasoning for it.
Please be positive and constructive with your questions and comments.