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):
-
1\$\begingroup\$ @Velvel Thanks, datasheet link updated \$\endgroup\$– SumoBBQSep 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 VoigtSep 6 at 14:52
-
\$\begingroup\$ Thanks for linking the correct datasheet. Chapter 5.2 contains lots of useful information, including good examples. \$\endgroup\$– VelvetSep 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\$– RuslanSep 6 at 20:14
2 Answers
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.
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.