Você está na página 1de 30

Tutorial -1

Number Systems

Numeric Formats

(473.85)10
Radix Point
Base /Radix gives no. of digits
0 -9

Base/ Radix

Numeric Formats
473.85
= 4 x 102 + 7 x 101 + 3 x 100 + 8 x 10-1 + 5 x 10-2
(N)10 = an-1 bn-1 + an-2 bn-2 + +a0 b0 +a-1 b-1 +..+a-m b-m
n no. of int digits
m no. of fractional digits

Number Format -Binary


Binary

Decimal

(101.11) 2

(5.75)10

Number Format - Octal


Octal

Decimal

(27.8) 8

(23.25)10

Number Format - Hexadecimal


Hexadecimal

Decimal

(A2.C) 16

(162.75)10

Tutorial Question 1: Find Base r


Example

Take Home

(361)10 = (551)r

(859)10 = (5B7)r
(982)10 = (1726)r

Conversion between no. formats


Any base no. has two parts
Integral
Left of radix point

Fractional
Right of radix point

Conversion different for both paths

E.g. (100.265)10 = (1100100.0100)2


2

100

50

25

12

1100100

0.265 x 2

0.
530 x 2

1.
060 x 2

0.
120 x 2

0.
240 x 2

0100

Tutorial Question 2
Octal Equivalent
Hex Equivalent

Octal to Binary
Octal
0
1

Binary
000
001

2
3
4

010
011
100

5
6
7

101
110
111

Hexadecimal to Binary
Hex
0
1

Binary
0000
0001

Hex
8
9

Binary
1000
1001

2
3
4

0010
0011
0100

A
B
C

1010
1011
1100

5
6
7

0101
0110
0111

D
E
F

1101
1110
1111

Binary to Octal
(110001011100)2
110 001 011

100

(6134)8

Binary to Octal
(100001010100.010)2
100 001 010 100 .010

(4124.2)8

.2

Binary to Hexadecimal
(100001010100.010)2
1000

0101

0100

.010

1000

0101

0100

.0100

.4

(854.4)16

Complements
Diminished Radix
(r-1)s complement
9s complement
1s complement

Radix
rs complement
10s complement
2s complement

Tutorial Question 3- Complements


Example

Take Home

Find Radix and Diminished


Radix complements of
(01011)2
(4723)8

Find Radix and Diminished


Radix complements of
(5921)10
(ABC1)16

Signed Numbers
Signed Magnitude Form
Followed in Computers

(- 23)10 8-bit signed magnitude


1 sign bit ; 7-bit magnitude in 2s complement
form

23

- 23

-23

0010111
1101001

Signed Magnitude
8 bit
+127 to -128

16-bit
+65,535 to - 65536

Tutorial Question 4-Signed Arithmetic


Example

Take Home

1101 + 1110 + 1001


1100.010 1000.111

101011 + 10111
11101 - 10110

Binary Codes

n- digit code
2n combinations
4 digits
16 combinations (hexadecimal)

BCD codes also called NBCD


Decimal NBCD
0
1
2

0000
0001
0010

3
4
5
6
7
8
9

0011
0100
0101
0110
0111
1000
1001

Rest of combinations
invalid
Invalid
1010
1011
1100
1101
1110
1111

Tutorial Question 5 BCD Arithmetic


0001 + 0101
1000 + 1001
0100 + 1000

Other Decimal Codes


Weighted Codes
Each bit position has a weight
BCD 8421
2421

Non Weighted
Excess 3

2421
Decimal 2421
0
1
2

0000
0001
0010

3
4
5
6
7
8
9

0011
0100
0101
0110
0111
1110
1111

Rest of combinations
invalid
Invalid
1010
1011
1100
1101
1000
1001

Tutorial Question 6
7421 code (0-9)
84-2-1 code (0-9)

Excess 3
Decimal

Excess 3

0
1
2

0011
0100
0101

3
4
5
6
7
8
9

0110
0111
1000
1001
1010
1011
1100

Rest of combinations
invalid
Invalid
0000
0001
0010
1101
1110
1111

Self Complementing Codes


2421
(2)10

0110
Complement 1001
Decimal value - (7)10

7 9s complement of 2
Self- complementing

Tutorial Question 7
Is 8421 complementing ?
Is Excess -3 complementing ?

Self Study Topics


Grey Codes
ASCII Codes

Você também pode gostar