Professor: Gabriel Soares Baptista
$$\begin{split} 789_{16} &= (7\times 16^{3-1}) + (8\times 16^{2-1}) + (9\times 16^{1-1}) \\ &= (7\times 256) + (8\times 16) + (9\times 1) \\ &= 1792 + 128 + 9 \\ &\boxed{789_{16}=1929_{10}} \end{split}$$
Em binário ($b=2$) com 4 bits, representamos $2^4 = 16$ números (de 0 a 15).
$$ \begin{split}453 \div 2 &= 226 \text{, resto } 1 \text{ (LSB)}\\226 \div 2 &= 113 \text{, resto } 0 \\113 \div 2 &= 56 \text{, resto } 1 \\56 \div 2 &= 28 \text{, resto } 0 \\28 \div 2 &= 14 \text{, resto } 0 \\14 \div 2 &= 7 \text{, resto } 0 \\7 \div 2 &= 3 \text{, resto } 1 \\3 \div 2 &= 1 \text{, resto } 1 \\1 \div 2 &= 0 \text{, resto } 1 \text{ (MSB)}\end{split}$$
$$\boxed{453_{10} = 111000101_2}$$
$$\begin{split} 365_{10} \div 16 &= 22 \text{, resto } 13 \,(D) \\ 22 \div 16 &= 1 \text{, resto } 6 \\ 1 \div 16 &= 0 \text{, resto } 1 \end{split}$$
$$\boxed{365_{10} = 16D_{16}}$$
$$\begin{array}{l} 1 \times 2 = 2 \to +\,1 = 3 \\ 3 \times 2 = 6 \to +\,0 = 6 \\ 6 \times 2 = 12 \to +\,1 = 13 \\ 13 \times 2 = 26 \to +\,1 = 27 \end{array}$$
$$\boxed{11011_{2} = 27_{10}}$$
Como $2^4 = 16$, a conversão é feita por agrupamento de 4 bits (nibbles).
Exemplo: $1110100110_{2} = \underbrace{0011}_{3} \;\; \underbrace{1010}_{A}\;\; \underbrace{0110}_{6} = 3A6_{16}$.
$$\begin{array}{ccc l} 8 & 7 & 4 & \text{(decimal)} \\ \downarrow & \downarrow & \downarrow & \\ 1000 & 0111 & 0100 & \text{(BCD)} \end{array}$$
| Decimal | Binário | Gray |
|---|---|---|
| 2 | 010 | 011 |
| 3 | 011 | 010 |
| 4 | 100 | 110 |
Note que de 3 para 4 no binário mudam 3 bits; no Gray, apenas 1.
$$\begin{array}{r cccc l} & 1 & 0 & 1 & 1 & \text{(B)} \\ \oplus & 0 & 1 & 0 & 1 & \text{(B}\gg\text{1)} \\ \hline & 1 & 1 & 1 & 0 & \text{(Gray)} \end{array}$$
| C | O | S | T | [espaço] | = | [espaço] | $ | 7 | 2 |
|---|---|---|---|---|---|---|---|---|---|
| 43 | 4F | 53 | 54 | 20 | 3D | 20 | 24 | 37 | 32 |
O número decimal $52931$ em BCD usa 5 dígitos $\times$ 4 bits = 20 bits. Isso equivale a 2,5 bytes ou 5 nibbles.