Appendix B
Number Systems, Hex Mask
B–4
Example: BCD bit pattern 0111
2,
for one digit, has a decimal equivalent
value of 7:
1
0
1 1
1x2
0
= 1
1x2
1
= 2
1x2
2
= 4
0x2
3
= 0
1
2
4
0
7
+
To form multiple digit numbers, BCD uses a 16–bit pattern similar to binary.
This allows up to 4 digits, using the above 4–bit binary code. BCD numbers
have a range of 0 to 32,767 in the SLC 500 family processors.
The following figure shows the BCD representation for the decimal number
9862:
Position Values
0
1
0 1
0
1
0 0
1
0
1 0
0
0
1 0
9
8
6
2
Binary Pattern
Thousands
Hundreds
Tens
Ones
8 4 2 1
8 4 2 1
8 4 2 1
8 4 2 1
Decimal value
Hexadecimal numbers use single characters 0 to 9 and A to F, to represent
decimal values ranging from 0 to 15:
1
0
2 3
5
4
6 7
9
8
A
B
D
C
E
F
1
0
2 3
5
4
6 7
9
8
10 11
13
12
14 15
HEX
Decimal
The position values of hexadecimal numbers are powers of 16, beginning
with 16
0
at the right:
16
3
16
2
16
1
16
0
Example: Hexadecimal number 218A has a decimal equivalent value of
8586:
1
2
8 A
10x16
0
= 10
8x16
1
= 128
1x16
2
= 256
2x16
3
= 8192
10
128
256
8192
8586
Hexadecimal Numbers