Decimal representation of a bit pattern

The STB and ESR registers contain 8 bits, the SCPI registers contain 16 bits. The contents of a status register are specified and transferred as a single decimal number. Each bit is assigned a weighted value. The decimal number is calculated as the sum of the weighted values of all bits in the register that are set to 1.

Bits

0

1

2

3

4

5

6

7

...

Weight

1

2

4

8

16

32

64

128

...

Example

The decimal value 40 = 32 + 8 indicates that bits no. 3 and 5 in the status register are set.