# Datasheet register bit number

When it is written that to check if some flag bit is set, you have to look at for example 0x74[2], does that 2 means 3rd bit of register or 2nd? From which number they count in datasheet 0 or 1, how to determine that?

It is common for register bit numbering to start at bit 0, but there are exceptions. That is why, to be sure of the correct answer for a specific device, you need to read its datasheet:

• If you see a mention of bit 8 within a byte, then the bit numbering starts from 1
• If you see a mention of bit 0 within a byte, then the bit numbering starts from 0

Obviously things are more complicated when referring to registers larger than a byte (i.e. larger than 8 bits), but the same principle applies.

Here is an example from a datasheet which you've asked about before:

[Source]

You can see that in this device's datasheet, a register's bit numbering is from 0 to 7 as highlighted with the red border, so that answers your question about the starting bit number.

In standard datasheet, Counting of bits in register always starts from 0th bit. Means as per your example the xxx[2] means third LSB bit.

• Except when reading SAE standard, where they count from 1 to 8. Really depends on the publisher! Commented Jun 23, 2017 at 12:08
• @Jeroen3,Yes correct! Commented Jun 23, 2017 at 12:10
• If it is a power architecture device, the highest numbered bit is the least significant which can make life interesting. Commented Jun 23, 2017 at 12:25

By context. Does the document ever reference bit [0] or a register, or bit[32]? Find the table for the full register at some address. This will typically identify all 32 bits with wither a function, reserved, not implemented (and so on).

Why don't you open the data sheet, go to the page that describes the relevant flags and see for yourself what position they are in the byte(s) they are contained within. It's a lot safer to do this than to expect there to be some generic answer that is always 100% accurate.