01.12.2014 Views

Aula 6 - Sistemas de Numeracao - Iris.sel.eesc.sc.usp.br

Aula 6 - Sistemas de Numeracao - Iris.sel.eesc.sc.usp.br

Aula 6 - Sistemas de Numeracao - Iris.sel.eesc.sc.usp.br

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Aula</strong> 6<<strong>br</strong> />

<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

SEL 0414 - <strong>Sistemas</strong> Digitais<<strong>br</strong> />

Prof. Dr. Marcelo Andra<strong>de</strong> da Costa Vieira


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

1. SISTEMA DECIMAL<<strong>br</strong> />

• Composto por 10 símbolos ou numerais;<<strong>br</strong> />

• Base 10 0, 1, 2, 3, 4, 5, 6, 7, 8, 9.<<strong>br</strong> />

a n-1 ...a 3 a 2 a 1 a 0 = a n-1 10 n-1 +...+ a 3 10 3 + a 2 10 2 + a 1 10 1 + a 0 10 0<<strong>br</strong> />

Ex.: (4598) 10 = 4.10 3 + 5.10 2 + 9.10 1 + 8.10 0 =<<strong>br</strong> />

4000 + 500 + 90 + 8


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

1. SISTEMA DECIMAL


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

1. SISTEMA DECIMAL


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

2. SISTEMA BINÁRIO<<strong>br</strong> />

• Composto por 2 símbolos ou numerais;<<strong>br</strong> />

• Base 2 0, 1.<<strong>br</strong> />

b n-1 ...b 3 b 2 b 1 b 0 = b n-1 2 n-1 + ... + b 3 2 3 + b 2 2 2 + b 1 2 1 + b 0 2 0<<strong>br</strong> />

Ex.: (110100) 2 = 1.2 5 + 1.2 4 + 0.2 3 + 1.2 2 + 0.2 1 + 0.2 0<<strong>br</strong> />

l Definições:<<strong>br</strong> />

Dígito Binário (Binary Digit ou Bit)<<strong>br</strong> />

Nibble – 4 dígitos binários (4 Bits)<<strong>br</strong> />

Byte – 8 dígitos binários (8 Bits)


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

2. SISTEMA BINÁRIO<<strong>br</strong> />

Contagem <strong>de</strong> 0 a (2 N -1)


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

2. SISTEMA BINÁRIO<<strong>br</strong> />

“Most Significant Bit” “Less Significant Bit”


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

1. BINÁRIO DECIMAL<<strong>br</strong> />

CONVERSÃO ENTRE SISTEMAS<<strong>br</strong> />

DE NUMERAÇÃO<<strong>br</strong> />

110100<<strong>br</strong> />

(110100) 2 = 1.2 5 + 1.2 4 + 0.2 3 + 1.2 2 + 0.2 1 + 0.2 0 =<<strong>br</strong> />

= 32 + 16 + 4 = (52) 10


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

CONVERSÃO ENTRE SISTEMAS<<strong>br</strong> />

DE NUMERAÇÃO<<strong>br</strong> />

2. DECIMAL BINÁRIO<<strong>br</strong> />

Ex.: (49) 10 à (?) 2<<strong>br</strong> />

(49) 10 = (110001) 2


Técnica para Conversão <strong>de</strong><<strong>br</strong> />

Decimal para Binário<<strong>br</strong> />

121 =<<strong>br</strong> />

1111001<<strong>br</strong> />

121 2<<strong>br</strong> />

1 60 2<<strong>br</strong> />

0 30 2<<strong>br</strong> />

0 15 2<<strong>br</strong> />

1 7 2<<strong>br</strong> />

1 3 2<<strong>br</strong> />

1 1


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

BINÁRIO DECIMAL<<strong>br</strong> />

CONVERSÃO ENTRE SISTEMAS<<strong>br</strong> />

DE NUMERAÇÃO<<strong>br</strong> />

Com dígitos após a vírgula (números não inteiros)<<strong>br</strong> />

Ex. 11110,01<<strong>br</strong> />

(11110,01) 2 = 1.2 4 +1.2 3 +1.2 2 +1.2 1 +0.2 0 +0.2 -1 +1.2 -2<<strong>br</strong> />

= 16 + 8 + 4 + 2 + 0,25 = (30,25) 10


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

DECIMAL BINÁRIO<<strong>br</strong> />

CONVERSÃO ENTRE SISTEMAS<<strong>br</strong> />

DE NUMERAÇÃO<<strong>br</strong> />

Com dígitos após a vírgula (números não inteiros)<<strong>br</strong> />

• Calcula-se a conversão da parte inteira e da parte<<strong>br</strong> />

fracionária separadamente;<<strong>br</strong> />

• Para a parte fracionária, utiliza-se o método das<<strong>br</strong> />

multiplicações sucessivas:<<strong>br</strong> />

• Multiplica-se o nº fracionário por 2.<<strong>br</strong> />

• Desse resultado, a parte inteira será utilizada como<<strong>br</strong> />

dígito binário e a parte fracionária restante é<<strong>br</strong> />

novamente multiplicada por 2.<<strong>br</strong> />

• Repete-se o processo até que a parte fracionária do<<strong>br</strong> />

último produto seja igual a zero.


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

CONVERSÃO ENTRE SISTEMAS<<strong>br</strong> />

DE NUMERAÇÃO<<strong>br</strong> />

DECIMAL BINÁRIO<<strong>br</strong> />

Com dígitos após a vírgula (números não inteiros)<<strong>br</strong> />

Ex. 4,1875<<strong>br</strong> />

(4) 10 = (100) 2<<strong>br</strong> />

(0,1875) 10 = 0,1875 x 2 = 0,3750 = 0 + 0,3750<<strong>br</strong> />

0,3750 x 2 = 0,7500 = 0 + 0,7500<<strong>br</strong> />

0,7500 x 2 = 1,5000 = 1 + 0,5000<<strong>br</strong> />

0,5000 x 2 = 1,0000 = 1 + 0,0000<<strong>br</strong> />

= (0011) 2<<strong>br</strong> />

(4,1875) 10 = (100,0011) 2


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

3. SISTEMA OCTAL<<strong>br</strong> />

• Composto por 8 símbolos ou numerais;<<strong>br</strong> />

• Base 8 0, 1, 2, 3, 4, 5, 6, 7.<<strong>br</strong> />

o n-1 ...o 3 o 2 o 1 o 0 = o n-1 8 n-1 + ... + o 3 8 3 + o 2 8 2 + o 1 8 1 + o 0 8 0<<strong>br</strong> />

Ex.: (372) 8 = 3.8 2 + 7.8 1 + 2.8 0 = (250) 10


Conversão <strong>de</strong> Decimal para Octal<<strong>br</strong> />

(179) 10 = ?<<strong>br</strong> />

l Exemplo: Resposta:<<strong>br</strong> />

179 8<<strong>br</strong> />

3 22 8 (263) 8<<strong>br</strong> />

6 2


Conversão <strong>de</strong> Octal para Decimal<<strong>br</strong> />

l Exemplo: 274<<strong>br</strong> />

(274) 8 =<<strong>br</strong> />

2<<strong>br</strong> />

2 x 8 = 128 128 +<<strong>br</strong> />

1<<strong>br</strong> />

7 x 8 = 56 56 +<<strong>br</strong> />

0<<strong>br</strong> />

4 x 8 = 4 4 +<<strong>br</strong> />

(188) 10


Conversão <strong>de</strong> Binário para Octal<<strong>br</strong> />

e Vice-Versa<<strong>br</strong> />

Binário Octal<<strong>br</strong> />

000 0<<strong>br</strong> />

001 1<<strong>br</strong> />

010 2<<strong>br</strong> />

011 3<<strong>br</strong> />

100 4<<strong>br</strong> />

101 5<<strong>br</strong> />

110 6<<strong>br</strong> />

111 7<<strong>br</strong> />

l Como 8 é a terceira<<strong>br</strong> />

potência <strong>de</strong> 2, po<strong>de</strong>-se<<strong>br</strong> />

converter <strong>de</strong> octal em<<strong>br</strong> />

binário transformando<<strong>br</strong> />

cada dígito octal em seu<<strong>br</strong> />

equivalente com 3<<strong>br</strong> />

dígitos binários.


Conversão <strong>de</strong> Octal para Binário<<strong>br</strong> />

• Exemplo ð 257<<strong>br</strong> />

2 5 7<<strong>br</strong> />

<<strong>br</strong> />

010 101 111<<strong>br</strong> />

l Resposta 010 101 111


Conversão <strong>de</strong> Binário para Octal<<strong>br</strong> />

l A conversão <strong>de</strong> binário para octal é o<<strong>br</strong> />

inverso dos procedimentos acima;<<strong>br</strong> />

l Agrupe os bits <strong>de</strong> três em três, e<<strong>br</strong> />

converta cada grupo em seu<<strong>br</strong> />

equivalente octal;<<strong>br</strong> />

l Se houver necessida<strong>de</strong>, adicione zeros<<strong>br</strong> />

à esquerda do número binário.


Conversão <strong>de</strong> Binário para Octal<<strong>br</strong> />

Exemplo ð 10101111<<strong>br</strong> />

010 101 111<<strong>br</strong> />

<<strong>br</strong> />

2 5 7<<strong>br</strong> />

l Resposta 257


Sequência <strong>de</strong> Números Octal<<strong>br</strong> />

0 14 30 104<<strong>br</strong> />

1 15 31 105<<strong>br</strong> />

2 16 .... ....<<strong>br</strong> />

3 17 .... ....<<strong>br</strong> />

4 20 .... ....<<strong>br</strong> />

5 21 75 776<<strong>br</strong> />

6 22 76 777<<strong>br</strong> />

7 23 77 1000<<strong>br</strong> />

10 24 100 1001<<strong>br</strong> />

11 25 101 ....<<strong>br</strong> />

12 26 102 ....<<strong>br</strong> />

13 27 103 ....


<strong>Sistemas</strong> <strong>de</strong> Numeração<<strong>br</strong> />

4. SISTEMA HEXADECIMAL<<strong>br</strong> />

• Composto por 16 símbolos ou numerais;<<strong>br</strong> />

• Base 16 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.<<strong>br</strong> />

h n-1 ...h 3 h 2 h 1 h 0 = h n-1 16 n-1 +...+ h 3 16 3 + h 2 16 2 + h 1 16 1 + h 0 16 0<<strong>br</strong> />

Ex.: (1A7) 16 = 1.16 2 + 10.16 1 + 7.16 0 = (423) 10


Conversão <strong>de</strong> Decimal em Hexa<<strong>br</strong> />

l Exemplo:<<strong>br</strong> />

9 9<<strong>br</strong> />

2479 16 10 A<<strong>br</strong> />

15 154 16 15 F<<strong>br</strong> />

10 9<<strong>br</strong> />

9AF


Conversão <strong>de</strong> Hexa para Decimal<<strong>br</strong> />

l Exemplo: 9AF<<strong>br</strong> />

2<<strong>br</strong> />

9 x 16 = 2304 2304 +<<strong>br</strong> />

1<<strong>br</strong> />

A x 16 = 160 160 +<<strong>br</strong> />

0<<strong>br</strong> />

F x 16 = 15 15 +<<strong>br</strong> />

2479


Conversão <strong>de</strong> Hexa para Binário<<strong>br</strong> />

l Para converter um número hexa<strong>de</strong>cimal em<<strong>br</strong> />

um número binário, converta cada dígito<<strong>br</strong> />

hexa<strong>de</strong>cimal em seu equivalente <strong>de</strong> 4 bits;<<strong>br</strong> />

l A vantagem do sistema hexa<strong>de</strong>cimal, é<<strong>br</strong> />

po<strong>de</strong>r agrupar cada conjunto <strong>de</strong> 4 dígitos<<strong>br</strong> />

binários em apenas 1 dígito hexa;<<strong>br</strong> />

l Muito utilizado em en<strong>de</strong>reçamento <strong>de</strong><<strong>br</strong> />

memória.


Números Hexa<strong>de</strong>cimais<<strong>br</strong> />

Dec Binário Hexa<<strong>br</strong> />

0 0000 0<<strong>br</strong> />

1 0001 1<<strong>br</strong> />

2 0010 2<<strong>br</strong> />

3 0011 3<<strong>br</strong> />

4 0100 4<<strong>br</strong> />

5 0101 5<<strong>br</strong> />

6 0110 6<<strong>br</strong> />

7 0111 7<<strong>br</strong> />

Dec Binário Hexa<<strong>br</strong> />

8 1000 8<<strong>br</strong> />

9 1001 9<<strong>br</strong> />

10 1010 A<<strong>br</strong> />

11 1011 B<<strong>br</strong> />

12 1100 C<<strong>br</strong> />

13 1101 D<<strong>br</strong> />

14 1110 E<<strong>br</strong> />

15 1111 F


Conversão <strong>de</strong> Hexa para Binário<<strong>br</strong> />

9AF<<strong>br</strong> />

9 A F<<strong>br</strong> />

<<strong>br</strong> />

1001 1010 1111<<strong>br</strong> />

l Resposta 100110101111


Conversão <strong>de</strong> Binário em Hexa<<strong>br</strong> />

Exemplo 1110101101<<strong>br</strong> />

0011 1010 1101<<strong>br</strong> />

<<strong>br</strong> />

3 A D<<strong>br</strong> />

l Resposta 3AD


Sequência <strong>de</strong> Números Hexa<strong>de</strong>cimal<<strong>br</strong> />

0 C 18 99 FA 9FD<<strong>br</strong> />

1 D 19 9A FB 9FE<<strong>br</strong> />

2 E 1A 9B FC 9FF<<strong>br</strong> />

3 F 1B 9C FD A00<<strong>br</strong> />

4 10 1C 9D FE A01<<strong>br</strong> />

5 11 1D 9E FF .....<<strong>br</strong> />

6 12 1E 9F 100 .....<<strong>br</strong> />

7 13 1F A0 101 FFE<<strong>br</strong> />

8 14 20 A1 102 FFF<<strong>br</strong> />

9 15 ... ... .... 1000<<strong>br</strong> />

A 16 ... ... .... 1001<<strong>br</strong> />

B 17 98 F9 9FC .......


Código BCD<<strong>br</strong> />

DECIMAL BINÁRIO ou BINÁRIO DECIMAL<<strong>br</strong> />

l Muito complicado na prática<<strong>br</strong> />

l Hardware complexo<<strong>br</strong> />

l Binário Puro<<strong>br</strong> />

Alternativa:<<strong>br</strong> />

l Uso <strong>de</strong> um Código<<strong>br</strong> />

l Decimal codificado em Binário


Funções Códigos/Decodificadores<<strong>br</strong> />

Lógicas<<strong>br</strong> />

1. CÓDIGO BCD (Binary-Co<strong>de</strong>d Decimal)<<strong>br</strong> />

l Cada dígito <strong>de</strong>cimal é representado por um<<strong>br</strong> />

“código” equivalente em binário;<<strong>br</strong> />

l Não é um sistema <strong>de</strong> numeração;<<strong>br</strong> />

l É diferente <strong>de</strong> conversão em binário puro;<<strong>br</strong> />

l Quantos bits?<<strong>br</strong> />

l 4 bits<<strong>br</strong> />

l 16 códigos possíveis → só se usa 10 para<<strong>br</strong> />

o sistema <strong>de</strong>cimal


Código BCD 8421<<strong>br</strong> />

Decimal Binário<<strong>br</strong> />

0 0000<<strong>br</strong> />

1 0001<<strong>br</strong> />

2 0010<<strong>br</strong> />

3 0011<<strong>br</strong> />

4 0100<<strong>br</strong> />

5 0101<<strong>br</strong> />

6 0110<<strong>br</strong> />

7 0111<<strong>br</strong> />

Decimal Binário<<strong>br</strong> />

8 1000<<strong>br</strong> />

9 1001<<strong>br</strong> />

10 1010<<strong>br</strong> />

11 1011<<strong>br</strong> />

12 1100<<strong>br</strong> />

13 1101<<strong>br</strong> />

14 1110<<strong>br</strong> />

15 1111<<strong>br</strong> />

Não<<strong>br</strong> />

Utilizado


Funções Códigos/Decodificadores<<strong>br</strong> />

Lógicas<<strong>br</strong> />

1. CÓDIGO BCD 8421 X Número Binário<<strong>br</strong> />

Decimal Binário BCD (8421)<<strong>br</strong> />

0<<strong>br</strong> />

1<<strong>br</strong> />

2<<strong>br</strong> />

3<<strong>br</strong> />

4<<strong>br</strong> />

5<<strong>br</strong> />

6<<strong>br</strong> />

7<<strong>br</strong> />

8<<strong>br</strong> />

9<<strong>br</strong> />

10<<strong>br</strong> />

11<<strong>br</strong> />

12<<strong>br</strong> />

...<<strong>br</strong> />

98<<strong>br</strong> />

99<<strong>br</strong> />

100<<strong>br</strong> />

101<<strong>br</strong> />

...<<strong>br</strong> />

578<<strong>br</strong> />

...<<strong>br</strong> />

0<<strong>br</strong> />

1<<strong>br</strong> />

10<<strong>br</strong> />

11<<strong>br</strong> />

100<<strong>br</strong> />

101<<strong>br</strong> />

110<<strong>br</strong> />

111<<strong>br</strong> />

1000<<strong>br</strong> />

1001<<strong>br</strong> />

1010<<strong>br</strong> />

1011<<strong>br</strong> />

1100<<strong>br</strong> />

...<<strong>br</strong> />

1100010<<strong>br</strong> />

1100011<<strong>br</strong> />

1100100<<strong>br</strong> />

1100101<<strong>br</strong> />

...<<strong>br</strong> />

1001000010<<strong>br</strong> />

...<<strong>br</strong> />

0000<<strong>br</strong> />

0001<<strong>br</strong> />

0010<<strong>br</strong> />

0011<<strong>br</strong> />

0100<<strong>br</strong> />

0101<<strong>br</strong> />

0110<<strong>br</strong> />

0111<<strong>br</strong> />

1000<<strong>br</strong> />

1001<<strong>br</strong> />

0001 0000<<strong>br</strong> />

0001 0001<<strong>br</strong> />

0001 0010<<strong>br</strong> />

...<<strong>br</strong> />

1001 1000<<strong>br</strong> />

1001 1001<<strong>br</strong> />

0001 0000 0000<<strong>br</strong> />

0001 0000 0001<<strong>br</strong> />

...<<strong>br</strong> />

0101 0111 1000<<strong>br</strong> />

...


Outros Códigos BCD


Conversão <strong>de</strong> Decimal para BCD<<strong>br</strong> />

l Exemplo 137<<strong>br</strong> />

1 3 7<<strong>br</strong> />

<<strong>br</strong> />

0001 0011 0111<<strong>br</strong> />

l Resposta<<strong>br</strong> />

(000100110111) BCD 12 bits<<strong>br</strong> />

l Em Binário (10001001) 2<<strong>br</strong> />

8 bits


Exercícios<<strong>br</strong> />

1. (37) 10 => ( 100101 ) 2<<strong>br</strong> />

2. (177) 10 => ( 261 ) 8 => ( 010110001 ) 2<<strong>br</strong> />

3. (5431) 8 => ( B19 ) 16 => ( 0010100001000001 ) BCD<<strong>br</strong> />

4. (214) 10 => ( D6 ) 16 => ( 11010110 ) 2


FIM

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!