Download presentation
Presentation is loading. Please wait.
1
Number Systems and Codes Discussion D4.1
2
Number Systems Counting in Binary Positional Notation Hexadecimal Numbers Negative Numbers
3
Counting in Binary Position:8421 0000000000 0001100011 0010200102 0011300113 0100401004 0101501015 0110601106 0111701117 1000810008 BINARY HEX
4
Counting in Binary Position:8421 1000810008 1001910019 1010A1010A 1011B1011B 1100C1100C 1101D1101D 1110E1110E 1111F1111F BINARY HEX
5
Counting in Binary 128 64 32 16 8 4 2 1 0 0 1 1 0 1 0 0 52 1 0 1 0 0 0 1 1163 1 1 1 1 1 1 1 1 255 BINARY DEC
6
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 584 10 = 5 x 10 2 + 8 x 10 1 + 4 x 10 0 = 500 + 80 + 4 = 584
7
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 10110 2 = 1 x 2 4 + 0 x 2 3 + 1 x 2 2 + 1 x 2 1 + 0 x 2 0 = 16 + 0 + 4 + 2 + 0 = 22 10 Binary
8
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 16 2 + A x 16 1 + F x 16 0 = 3 x 256 + 10 x 16 + 15 x 1 = 768 + 160 + 15 = 943 10 Hex
9
Binary Hex 0110 1010 1000 6A86A8 F5 C 1111 0101 1100
10
Questions What is the decimal value of 243 5 ? 2 x 5 2 +4 x 5+3 = 50+20+3 = 73
11
Negative Numbers Subtract by adding 73 -35 38 10’s complement 73 +65 138 Ignore carry
12
Negative Numbers 10’s complement : Subtract from 100 100 -35 65 Take 9’s complement and add 1 99 -35 64 +1 65
13
Negative Numbers 2’s complement: Subtract from 100000000 01001101 10110011 Take 1’s complement and add 1 11111111 -01001101 10110010 +1 10110011
14
Finding 2’s Complement 0 1 0 1 1 0 0 0 Copy all bits to first 1 2’s complement 0001 Complement remaining bits 0101
15
Negative Number Take 2’s Complement 75 10 = 4B 16 = 01001011 -75 10 = B5 16 = 10110101 FF -4B B4 +1 B5
16
Negative Number Take 2’s Complement 1 10 = 01 16 = 00000001 -1 10 = FF 16 = 11111111 128 10 = 80 16 = 10000000 -128 10 = 80 16 = 10000000
18
Signed Numbers 4-bit: 8H = -8 to 7H = +7 1000 to 0111 8-bit: 80H = -128 to 7F = +127 16-bit: 8000H = -32,768 to 7FFFH = +32,767 32-bit: 80000000H = -2,147,483,648 to 7FFFFFFFH = +2,147,483,647
19
Questions What is the two’s complement of 00101100? 11010100
20
Questions What hex number represents the decimal number -40? 40 10 = 28 16 = 00101000 2 2’s comp 11011000 2 = D8 16
21
Gray Code Note that the least significant bit that can be changed without repeating a value is the bit that is changed 000001 010011 011010 100110 101111 110101 111100 Binary Gray Code
22
Binary-Coded Decimal (BCD) 10010101 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 95 16 = 149 10 However, as a BCD number it represents the decimal number 95.
23
Standard ASCII Codes
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.