ASCII
As tabelas mostradas neste post representam os 256 códigos usados nos computadores da família IBM. Esta tabela refere-se ao American Standard Code for Information Interchange (código padrão americano para troca de informações), que é um conjunto de números representando caracteres ou instruções de controle usados para troca de informações entre computadores entre si, entre periféricos (teclado, monitor, impressora) e outros dispositivos. Estes códigos tem tamanho de 1 byte com valores de 00h a FFh (0 a 255 decimal). Podemos dividir estes códigos em três conjuntos: controle, padrão e estendido.
Os primeiros 32 códigos de 00h até 1Fh (0 a 31 decimal), formam o conjunto de controle ASCII. Estes códigos são usados para controlar dispositivos, por exemplo uma impressora ou o monitor de vídeo. O código 0Ch (form feed) recebido por ima impressora gera um avanço de uma página. O código 0Dh (carriage return) é enviado pelo teclado quando a tecla ENTER é pressionada. Embora exista um padrão, alguns poucos dispositivos tratam diferentemente estes códigos e é necessário consultar o manual para saber exatamente como o equipamento lida com o código. Em alguns casos o código também pode representar um caracter imprimível. Por exemplo o código 01h representa o caracter J (happy face).
Os 96 códigos seguintes de 20h a 7Fh (32 a 127 decimal) formam o conjunto padrão ASCII. Todos os computadores lidam da mesma forma com estes códigos. Eles representam os caracteres usados na manipulação de textos: códigos-fonte, documentos, mensagens de correio eletrônico, etc. São constituídos das letras do alfabeto latino (minúsculo e maiúsculo) e alguns símbolos usuais.
Os restantes 128 códigos de 80h até FFh (128 a 255 decimal) formam o conjunto estendido ASCII. Estes códigos também representam caracteres imprimíveis porem cada fabricante decide como e quais símbolos usar. Nesta parte do código estão definidas os caracteres especiais: é, ç, ã, ü ...
Dec. | Hex. | Controle |
0 | 00h | NUL (Null) |
1 | 01h | SOH (Start of Heading) |
2 | 02h | STX (Start of Text) |
3 | 03h | ETX (End of Text) |
4 | 04h | EOT (End of Transmision) |
5 | 05h | ENQ (Enquiry) |
6 | 06h | ACK (Acknowledge) |
7 | 07h | BEL (Bell) |
8 | 08h | BS (Backspace) |
9 | 09h | HT (Horizontal Tab) |
10 | 0Ah | LF (Line Feed) |
11 | 0Bh | VT (Vertical Tab) |
12 | 0Ch | FF (Form Feed) |
13 | 0Dh | CR (Carriage Return) |
14 | 0Eh | SO (Shift Out) |
15 | 0Fh | SI (Shift In) |
16 | 10h | DLE (Data Link Escape) |
17 | 11h | DC1 (Device control 1) |
18 | 12h | DC2 (Device control 2) |
19 | 13h | DC3 (Device control 3) |
20 | 14h | DC4 (Device control 4) |
21 | 15h | NAK (Negative Acknowledge) |
22 | 16h | SYN (Synchronous Idle) |
23 | 17h | ETB (End Transmission Block) |
24 | 18h | CAN (Cancel) |
25 | 19h | EM (End of Media) |
26 | 1Ah | SUB (Substitute) |
27 | 1Bh | ESC (Escape) |
28 | 1Ch | FS (File Separator) |
29 | 1Dh | GS (Group Separator) |
30 | 1Eh | RS (Record Separator) |
31 | 1Fh | US (Unit Separator) |
Caracter | Dec. | Hex. |
| 32 | 20h |
! | 33 | 21h |
" | 34 | 22h |
# | 35 | 23h |
$ | 36 | 24h |
% | 37 | 25h |
& | 38 | 26h |
' | 39 | 27h |
( | 40 | 28h |
) | 41 | 29h |
* | 42 | 2Ah |
+ | 43 | 2Bh |
, | 44 | 2Ch |
- | 45 | 2Dh |
. | 46 | 2Eh |
/ | 47 | 2Fh |
0 | 48 | 30h |
1 | 49 | 31h |
2 | 50 | 32h |
3 | 51 | 33h |
4 | 52 | 34h |
5 | 53 | 35h |
6 | 54 | 36h |
7 | 55 | 37h |
8 | 56 | 38h |
9 | 57 | 39h |
: | 58 | 3Ah |
; | 59 | 3Bh |
< | 60 | 3Ch |
= | 61 | 3Dh |
> | 62 | 3Eh |
? | 63 | 3Fh |
@ | 64 | 40h |
A | 65 | 41h |
B | 66 | 42h |
C | 67 | 43h |
D | 68 | 44h |
E | 69 | 45h |
F | 70 | 46h |
G | 71 | 47h |
H | 72 | 48h |
I | 73 | 49h |
J | 74 | 4Ah |
K | 75 | 4Bh |
L | 76 | 4Ch |
M | 77 | 4Dh |
N | 78 | 4Eh |
O | 79 | 4Fh |
P | 80 | 50h |
Q | 81 | 51h |
R | 82 | 52h |
S | 83 | 53h |
T | 84 | 54h |
U | 85 | 55h |
V | 86 | 56h |
W | 87 | 57h |
X | 88 | 58h |
Y | 89 | 59h |
Z | 90 | 5Ah |
[ | 91 | 5Bh |
\ | 92 | 5Ch |
] | 93 | 5Dh |
^ | 94 | 5Eh |
_ | 95 | 5Fh |
` | 96 | 60h |
a | 97 | 61h |
b | 98 | 62h |
c | 99 | 63h |
d | 100 | 64h |
e | 101 | 65h |
f | 102 | 66h |
g | 103 | 67h |
h | 104 | 68h |
i | 105 | 69h |
j | 106 | 6Ah |
k | 107 | 6Bh |
l | 108 | 6Ch |
m | 109 | 6Dh |
n | 110 | 6Eh |
o | 111 | 6Fh |
p | 112 | 70h |
q | 113 | 71h |
r | 114 | 72h |
s | 115 | 73h |
t | 116 | 74h |
u | 117 | 75h |
v | 118 | 76h |
w | 119 | 77h |
x | 120 | 78h |
y | 121 | 79h |
z | 122 | 7Ah |
{ | 123 | 7Bh |
| | 124 | 7Ch |
} | 125 | 7Dh |
~ | 126 | 7Eh |
| 127 | 7Fh |
Ç | 128 | 80h |
ü | 129 | 81h |
é | 130 | 82h |
â | 131 | 83h |
ä | 132 | 84h |
à | 133 | 85h |
å | 134 | 86h |
ç | 135 | 87h |
ê | 136 | 88h |
ë | 137 | 89h |
è | 138 | 8Ah |
ï | 139 | 8Bh |
î | 140 | 8Ch |
ì | 141 | 8Dh |
Ä | 142 | 8Eh |
Å | 143 | 8Fh |
É | 144 | 90h |
æ | 145 | 91h |
Æ | 146 | 92h |
ô | 147 | 93h |
ö | 148 | 94h |
ò | 149 | 95h |
û | 150 | 96h |
ù | 151 | 97h |
ÿ | 152 | 98h |
Ö | 153 | 99h |
Ü | 154 | 9Ah |
¢ | 155 | 9Bh |
£ | 156 | 9Ch |
¥ | 157 | 9Dh |
₧ | 158 | 9Eh |
ƒ | 159 | 9Fh |
ááááá | 160 | A0h |
í | 161 | A1h |
ó | 162 | A2h |
ú | 163 | A3h |
ñ | 164 | A4h |
Ñ | 165 | A5h |
ª | 166 | A6h |
º | 167 | A7h |
¿ | 168 | A8h |
⌐ | 169 | A9h |
¬ | 170 | AAh |
½ | 171 | ABh |
¼ | 172 | ACh |
¡ | 173 | ADh |
« | 174 | AEh |
» | 175 | AFh |
░ | 176 | B0h |
▒ | 177 | B1h |
▓ | 178 | B2h |
│ | 179 | B3h |
┤ | 180 | B4h |
╡ | 181 | B5h |
╢ | 182 | B6h |
╖ | 183 | B7h |
╕ | 184 | B8h |
╣ | 185 | B9h |
║ | 186 | BAh |
╗ | 187 | BBh |
╝ | 188 | BCh |
╜ | 189 | BDh |
╛ | 190 | BEh |
┐ | 191 | BFh |
└ | 192 | C0h |
┴ | 193 | C1h |
┬ | 194 | C2h |
├ | 195 | C3h |
─ | 196 | C4h |
┼ | 197 | C5h |
╞ | 198 | C6h |
╟ | 199 | C7h |
╚ | 200 | C8h |
╔ | 201 | C9h |
╩ | 202 | CAh |
╦ | 203 | CBh |
╠ | 204 | CCh |
═ | 205 | CDh |
╬ | 206 | CEh |
╧ | 207 | CFh |
╨ | 208 | DOh |
╤ | 209 | D1h |
╥ | 210 | D2h |
╙ | 211 | D3h |
╘ | 212 | D4h |
╒ | 213 | D5h |
╓ | 214 | D6h |
╫ | 215 | D7h |
╪ | 216 | D8h |
┘ | 217 | D9h |
┌ | 218 | DAh |
█ | 219 | DBh |
▄ | 220 | DCh |
▌ | 221 | DDh |
▐ | 222 | DEh |
▀ | 223 | DFh |
α | 224 | E0h |
ß | 225 | E1h |
Γ | 226 | E2h |
π | 227 | E3h |
Σ | 228 | E4h |
σ | 229 | E5h |
µ | 230 | E6h |
τ | 231 | E7h |
Φ | 232 | E8h |
Θ | 233 | E9h |
Ω | 234 | EAh |
δ | 235 | EBh |
∞ | 236 | ECh |
φ | 237 | EDh |
Î | 238 | EEh |
∩ | 239 | EFh |
≡ | 240 | F0h |
± | 241 | F1h |
≥ | 242 | F2h |
≤ | 243 | F3h |
⌠ | 244 | F4h |
⌡ | 245 | F5h |
÷ | 246 | F6h |
≈ | 247 | F7h |
° | 248 | F8h |
∙ | 249 | F9h |
· | 250 | FAh |
√ | 251 | FBh |
ⁿ | 252 | FCh |
² | 253 | FDh |
· | 254 | FEh |
| 255 | FFh |
Entre os caracteres da tabela ASCII estendidos os mais úteis estão, talvez, os caracteres de desenho de quadro em linhas simples e duplas: os caracteres de B3h até DAh (179 a 218 decimal). Como a visualização deste conjunto é difícil, o desenho abaixo pode auxiliar nesta tarefa:
196 194 205 203
218 ┌ ─ ┬ ┐ 191 201 ╔ ═ ╦ ╗ 187
179 │ 186 ║
195 ├ ┼ ┤ 180 204 ╠ ╬ ╣ 185
197 206
192 └ ┴ ┘ 217 200 ╚ ╩ ╝ 188
193 202
209 210
213 ╒ ╤ ╕ 184 214 ╓ ╥ ╖ 183
198 ╞ ╪ ╡ 181 199 ╟ ╫ ╢ 182
216 215
212 ╘ ╧ ╛ 190 211 ╙ ╨ ╜ 189
207 208
Caracteres de desenho de quadro e seus respectivos códigos ASII.