I am reading BMP280 datasheet (pressure&temperature sensor). On different pages they use the following notation: $$register\text{_}name[a:b]$$ where a, b are integers. For example, on page 13 "Enabling/disabling the temperature measurement and oversampling setting are selected through the osrs_t[2:0] bits in control register 0xF4".

How to interpret this notation?

  • \$\begingroup\$ In x86 microcode descriptions we would say its bits 2, 1 and 0. Might be the same in their notation. \$\endgroup\$ – PlasmaHH Aug 9 '18 at 11:19
  • \$\begingroup\$ @PlasmaHH, from left to right? So [a:b] means b, b+1, ..., a bits? \$\endgroup\$ – Turkhan Badalov Aug 9 '18 at 11:20
  • 2
    \$\begingroup\$ Bit 2:0 means bits 0 to 2. There's no "left and right", there's the LSB which is bit 0 and then count from there. \$\endgroup\$ – Lundin Aug 9 '18 at 11:21
  • \$\begingroup\$ These are the notations borrowed from the chip design language, Verilog or VHDL. Marketing and technical writers just use them for simplicity and convenience. \$\endgroup\$ – Ale..chenski Aug 9 '18 at 16:56
  • \$\begingroup\$ @AliChen - did you know that VHDL was originally conceived as a way of describing the behaviour of existing chips, not as a way of designing them? This is precisely the kind of application VHDL was originally supposed to be used for. \$\endgroup\$ – Jules Aug 9 '18 at 18:00

Those denote the bits within the register.

The bits are number 7, 6, 5, 4, 3, 2, 1, 0 so register 0xF4 is build up:

Control register 0xF4 bits: 7 6 5 4 3 2 1 0
                                   osrs_t bits

In <----> you can set the temperature measurement and oversampling setting (osrs_t).

In Table 5 of page 13 you can see exactly the values and their meaning for these 3 bits:

Datasheet excerpt

If osrs_t would be stored in the MSB first 3 bits it would be mentioned as osrs_t[7:5], and if the entire byte is used, normally the [] will not be shown.


It very likely means bits. osrs_t[2:0] would mean selected through bits 0, 1 and 2.

  • \$\begingroup\$ It is not "likely", it is with 110% confidence. \$\endgroup\$ – Ale..chenski Aug 9 '18 at 18:27
  • 1
    \$\begingroup\$ @AliChen: Unless it's an IBM document. Then it means bits 31, 30, and 29 or bits 63, 62, and 61. ;-) \$\endgroup\$ – R.. Aug 9 '18 at 18:44
  • \$\begingroup\$ @R.., that's probably why their hardware is out of business :-( \$\endgroup\$ – Ale..chenski Aug 9 '18 at 20:09
  • \$\begingroup\$ @R.. I did actually have the dysfunctional PowerPC hardware manuals in mind when I wrote "very likely". \$\endgroup\$ – Lundin Aug 10 '18 at 6:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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