Number Systems and Codes Discussion D4.1
Number Systems Counting in Binary Positional Notation Hexadecimal Numbers Negative Numbers
Counting in Binary Position: BINARY HEX
Counting in Binary Position: A1010A 1011B1011B 1100C1100C 1101D1101D 1110E1110E 1111F1111F BINARY HEX
Counting in Binary BINARY DEC
Positional Notation N = P 4 P 3 P 2 P 1 P 0 = P 4 b 4 + P 3 b 3 + P 2 b 2 + P 1 b 1 + P 0 b = 5 x x x 10 0 = = 584
Positional Notation N = P 4 P 3 P 2 P 1 P 0 = P 4 b 4 + P 3 b 3 + P 2 b 2 + P 1 b 1 + P 0 b = 1 x x x x x 2 0 = = Binary
Positional Notation N = P 4 P 3 P 2 P 1 P 0 = P 4 b 4 + P 3 b 3 + P 2 b 2 + P 1 b 1 + P 0 b 0 3AF 16 = 3 x A x F x 16 0 = 3 x x x 1 = = Hex
Binary Hex A86A8 F5 C
Questions What is the decimal value of ? 2 x x 5+3 = = 73
Negative Numbers Subtract by adding ’s complement Ignore carry
Negative Numbers 10’s complement : Subtract from Take 9’s complement and add
Negative Numbers 2’s complement: Subtract from Take 1’s complement and add
Finding 2’s Complement Copy all bits to first 1 2’s complement 0001 Complement remaining bits 0101
Negative Number Take 2’s Complement = 4B 16 = = B5 16 = FF -4B B4 +1 B5
Negative Number Take 2’s Complement 1 10 = = = FF 16 = = = = =
Signed Numbers 4-bit: 8H = -8 to 7H = to bit: 80H = -128 to 7F = bit: 8000H = -32,768 to 7FFFH = +32, bit: H = -2,147,483,648 to 7FFFFFFFH = +2,147,483,647
Questions What is the two’s complement of ?
Questions What hex number represents the decimal number -40? = = ’s comp = D8 16
Gray Code Note that the least significant bit that can be changed without repeating a value is the bit that is changed Binary Gray Code
Binary-Coded Decimal (BCD) Use 4-bit binary numbers 0000 – 1001 to represent the decimal digits, 0 – 9. Note that the six hex values A – F, 1010 – 1111, are NOT valid BCD values. Example: represents the hex value = However, as a BCD number it represents the decimal number 95.
Standard ASCII Codes