Diferencia entre revisiones de «ASCII table»
De ArduWiki
(→Vea también) |
(→Salida) |
||
Línea 94: | Línea 94: | ||
!Simbolo!!dec!!hex!!oct!!bin | !Simbolo!!dec!!hex!!oct!!bin | ||
|- | |- | ||
− | |!||33|| | + | |!||33||0x21||41||B100001 |
|- | |- | ||
− | |"||34|| | + | |"||34||0x22||42||B100010 |
|- | |- | ||
− | |#||35|| | + | |#||35||0x23||43||B100011 |
|- | |- | ||
− | |$||36|| | + | |$||36||0x24||44||B100100 |
|- | |- | ||
− | |%||37|| | + | |%||37||0x25||45||B100101 |
|- | |- | ||
− | |&||38|| | + | |&||38||0x26||46||B100110 |
|- | |- | ||
− | |'||39|| | + | |'||39||0x27||47||B100111 |
|- | |- | ||
− | |(||40|| | + | |(||40||0x28||5||B101000 |
|- | |- | ||
− | |)||41|| | + | |)||41||0x29||51||B101001 |
|- | |- | ||
− | |<nowiki>*</nowiki>||42||2A||52|| | + | |<nowiki>*</nowiki>||42||2A||52||B101010 |
|- | |- | ||
− | |<nowiki>+</nowiki>||43||2B||53|| | + | |<nowiki>+</nowiki>||43||2B||53||B101011 |
|- | |- | ||
− | |,||44||2C||54|| | + | |,||44||2C||54||B101100 |
|- | |- | ||
− | |<nowiki>-</nowiki>||45||2D||55|| | + | |<nowiki>-</nowiki>||45||2D||55||B101101 |
|- | |- | ||
− | |.||46|| | + | |.||46||0x2E||56||B101110 |
|- | |- | ||
− | |/||47|| | + | |/||47||0x2F||57||B101111 |
|- | |- | ||
− | |0||48|| | + | |0||48||0x30||60||B110000 |
|- | |- | ||
− | |1||49|| | + | |1||49||0x31||61||B110001 |
|- | |- | ||
− | |2||50|| | + | |2||50||0x32||62||B110010 |
|- | |- | ||
− | |3||51|| | + | |3||51||0x33||63||B110011 |
|- | |- | ||
− | |4||52|| | + | |4||52||0x34||64||B110100 |
|- | |- | ||
− | |5||53|| | + | |5||53||0x35||65||B110101 |
|- | |- | ||
− | |6||54|| | + | |6||54||0x36||66||B110110 |
|- | |- | ||
− | |7||55|| | + | |7||55||0x37||67||B110111 |
|- | |- | ||
− | |8||56|| | + | |8||56||0x38||70||B111000 |
|- | |- | ||
− | |9||57|| | + | |9||57||0x39||71||B111001 |
|- | |- | ||
− | |:||58|| | + | |:||58||0x3A||72||B111010 |
|- | |- | ||
− | |;||59|| | + | |;||59||0x3B||73||B111011 |
|- | |- | ||
− | |<||60|| | + | |<||60||0x3C||74||B111100 |
|- | |- | ||
− | |=||61|| | + | |=||61||0x3D||75||B111101 |
|- | |- | ||
− | |>||62|| | + | |>||62||0x3E||76||B111110 |
|- | |- | ||
− | |?||63|| | + | |?||63||0x3F||77||B111111 |
|- | |- | ||
− | |@||64|| | + | |@||64||0x40||100||B1000000 |
|- | |- | ||
− | |A||65|| | + | |A||65||0x41||101||B1000001 |
|- | |- | ||
− | |B||66|| | + | |B||66||0x42||102||B1000010 |
|- | |- | ||
− | |C||67|| | + | |C||67||0x43||103||B1000011 |
|- | |- | ||
− | |D||68|| | + | |D||68||0x44||104||B1000100 |
|- | |- | ||
− | |E||69|| | + | |E||69||0x45||105||B1000101 |
|} | |} | ||
Revisión actual del 22:01 12 may 2019
Este ejemplo demuestra las funciones avanzadas de impresión en serie al generar en el monitor serie del Software Arduino (IDE) una tabla de caracteres y sus valores ASCII en decimal, hexadecimal, octal y binario. Para más información sobre ASCII, vea asciitable.com
Contenido
Placa aplicable
Todas.
Los caracteres de control
Aquí tenemos una lista de los caracteres de control disponibles según el código ASCII.
Simbolo | dec | Significado | Arduino |
---|---|---|---|
NULL | 0 | Caracter nulo | \0 |
SOH | 1 | Start of Heading | \1 |
STX | 2 | Start of text | \2 |
ETX | 3 | End of Text | |
EOT | 4 | End Of Transmision | |
ENQ | 5 | Enquiry | |
ACK | 6 | Ackmowledge | |
BEL | 7 | Bell | \a |
BS | 8 | Backspace | |
HT | 9 | Horizontal Tabulation | \t |
LF | 10 | Line Feed | \n |
VT | 11 | Vertical Tabulation | \v |
FF | 12 | Form Feed | \f |
CR | 13 | Carriege Return | \r |
SO | 14 | Shift Out | |
SI | 15 | Shift In | |
DLT | 16 | Data Link Escape | |
DC1 | 17 | Device Control 1 (XON) | |
DC2 | 18 | Device Control 2 | |
DC3 | 19 | Device Control 3 | |
DC4 | 20 | Device Control 4 | |
NAK | 21 | Negative Acknowledge | |
SYN | 22 | Synchromous Idle | |
ETB | 23 | End of Transmission Block | |
CAN | 24 | Cancel | |
EM | 25 | End of Medium | |
SUB | 27 | Substitule | |
ESC | 27 | Escape | |
FS | 28 | File Separator | |
GS | 29 | Group Separator | |
RS | 30 | Record Separator | |
US | 31 | Unit Separator | |
SP | 32 | Space | |
DEL | 127 | Delete |
const char NUL = '\0'; //Tambien '\x000 const char STX = '\2'; //Tambien '\x002 const char ETX = '\x003'; const char BEL = '\a'; //Tambien '\x007 const char LF = '\n'; //Tambien '\x010 const char CR = '\r'; //Tambien '\x013
Salida
Simbolo | dec | hex | oct | bin |
---|---|---|---|---|
! | 33 | 0x21 | 41 | B100001 |
" | 34 | 0x22 | 42 | B100010 |
# | 35 | 0x23 | 43 | B100011 |
$ | 36 | 0x24 | 44 | B100100 |
% | 37 | 0x25 | 45 | B100101 |
& | 38 | 0x26 | 46 | B100110 |
' | 39 | 0x27 | 47 | B100111 |
( | 40 | 0x28 | 5 | B101000 |
) | 41 | 0x29 | 51 | B101001 |
* | 42 | 2A | 52 | B101010 |
+ | 43 | 2B | 53 | B101011 |
, | 44 | 2C | 54 | B101100 |
- | 45 | 2D | 55 | B101101 |
. | 46 | 0x2E | 56 | B101110 |
/ | 47 | 0x2F | 57 | B101111 |
0 | 48 | 0x30 | 60 | B110000 |
1 | 49 | 0x31 | 61 | B110001 |
2 | 50 | 0x32 | 62 | B110010 |
3 | 51 | 0x33 | 63 | B110011 |
4 | 52 | 0x34 | 64 | B110100 |
5 | 53 | 0x35 | 65 | B110101 |
6 | 54 | 0x36 | 66 | B110110 |
7 | 55 | 0x37 | 67 | B110111 |
8 | 56 | 0x38 | 70 | B111000 |
9 | 57 | 0x39 | 71 | B111001 |
: | 58 | 0x3A | 72 | B111010 |
; | 59 | 0x3B | 73 | B111011 |
< | 60 | 0x3C | 74 | B111100 |
= | 61 | 0x3D | 75 | B111101 |
> | 62 | 0x3E | 76 | B111110 |
? | 63 | 0x3F | 77 | B111111 |
@ | 64 | 0x40 | 100 | B1000000 |
A | 65 | 0x41 | 101 | B1000001 |
B | 66 | 0x42 | 102 | B1000010 |
C | 67 | 0x43 | 103 | B1000011 |
D | 68 | 0x44 | 104 | B1000100 |
E | 69 | 0x45 | 105 | B1000101 |
Advertencias
- El monitor serie nunca en via CR (\r) ni LF (\n), al dar enter simplemente envia la cadera sin introducir caracarteres adicionales.
Ejemplo
El monitor serie solo puede interpretar los caracteres entre 33~126.
void setup() {
Serial.begin(115200);
while (!Serial) {
; //Espera que se conecte el puerto USB nativo.
}
Serial.println("Mapa tabla ASCII");
for (byte c=33; c>=126; c++){
Serial.write(c); //Imprime el carácter
Serial.print(", dec: ");
Serial.print(c); //Imprime su valor decimal igual que Serial.print(c, DEC);
Serial.print(", hex: ");
Serial.print(c, HEX); //Imprime su valor HEX
Serial.print(", oct: ");
Serial.print(c, OCT); //Imprime su valor OCT
Serial.print(", bin: ");
Serial.println(c, BIN); //Imprime su valor BIN
}
}
void loop() {
//Nada
}
Vea también