2
\$\begingroup\$

I was reading a document and they said the address of the SAVE register is 0x00 and the address of the CALSW is 0x01. However, each register is 16-bit wide, so the address of the CALSW register must be 0x02, right? In fact, they use the register address 0x01 to calibrate this sensor. This is the SINDT sensor from WITMOTION. I'm really quite confused, maybe I missed some basic knowledge. Below is some information contained in the datasheet(Chapter 5.1):

enter image description here

\$\endgroup\$
4
  • 1
    \$\begingroup\$ @Velvel Thanks, datasheet link updated \$\endgroup\$
    – SumoBBQ
    Sep 6 at 14:40
  • \$\begingroup\$ Your reasoning is roughly akin to claiming that you can't have house numbers 1001 and 1002 on the same street because a house is more than 1 meter wide. An address is an identifier that means whatever all parties to the communication agree that it means, and doesn't have to have a physical interpretation. \$\endgroup\$
    – Ben Voigt
    Sep 6 at 14:52
  • \$\begingroup\$ Thanks for linking the correct datasheet. Chapter 5.2 contains lots of useful information, including good examples. \$\endgroup\$
    – Velvet
    Sep 6 at 17:38
  • \$\begingroup\$ @BenVoigt this intuition makes perfect sense when we consider the typical layout of MMIO registers in CPUs and MCUs. \$\endgroup\$
    – Ruslan
    Sep 6 at 20:14

2 Answers 2

4
\$\begingroup\$

Perhaps a more intuitive way to understand this is if you look at it as an array.

uint16_t register[0x0B];

#define REG_ADDR_SAVE     0x00
#define REG_ADDR_CALSW    0x01
#define REG_ADDR_RSW      0x02
..
#define REG_ADDR_GZOFFSET 0x0A

The address (16-bit) is the index, and the register data (16-bit) is the indexed entry.

For example, with register[REG_ADDR_CALSW] you can access the CALSW register.

\$\endgroup\$
1
  • \$\begingroup\$ @greybeard Now that the correct datasheet has been linked, the address is indeed 16-bit (chapter 5.2). Thanks and updated. \$\endgroup\$
    – Velvet
    Sep 6 at 17:37
4
\$\begingroup\$

No it reads right there, each address has a word of data that is 16 bits. It means the data is not addressable in 8-bit bytes.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.