what is a ASCII code

What is a ASCII Code

ASCII is an acronym for American Standard Code for Information Interchange.

It is a code that uses numbers to represent characters. Each letter is assigned a number between 0 and 127. A upper and lower case character are assigned different numbers. For example the character A is assigned the decimal number 65, while a is assigned decimal 97 as shown below int the ASCII table.

The ASCII code predates the Internet and has been around since the days of teletypes and mechanical printers. ASCII decimal numbers from 0 to 31 represent control codes that are not used that much these days. However if you are playing with communications protocols you will see these control codes in use. The ASCII Control Codes table explains what each of these control codes are.

When is ASCII code used

When a computer sends data the keys you press or the text you send and receive is sent as a bunch of numbers. These numbers represent the characters you typed or generated. Because the range of standard ASCII is 0 to 127 it only requires 7 bits or 1 byte of data. For example to send the string cactus.io as ascii it would translate to 99 97 99 116 117 115 46 105 111. Microprocessors only understand bits and bytes. To it everything is a sequence of bits.


What is the difference between an ASCII code and a HTML code

The original ASCII code only had a range of 128 characters which is very limited in the range of characters. It basically only supports the english character set. You could have used the extended ascii characters which ranged from 128 to 255. Because the ascii code range is 0 to 255 it can fit inside 1 byte of data.

The HTML code is based on the different character sets that can range from a single byte character set such as Latin-1 (ISO-8859-1) or UTF-8 which uses multiple bytes to represent a character. Using a charcter set such as UTF-8 gives us a much larger range of character sets.

When using a web browser the web site we are using would normally specify the character set it is using. For example in a HTML5 web page you might see the string <meta charset="utf-8"> in the page source. This tells the browser that the data being sent utilises the UTF-8 character table.

The HTML code is usually in the format of &#169;. The & tells the browser that it is a HTML code and not part of a string. The # after the & tells the browser that the following is an numerical value of a symbol. The ; is to tell the browser that is the end of the code. In the case of &#169;, this is the html code that represents the copyright symbol ©.

Where would I use ASCII codes or HTML codes

You would use ASCII codes for all normal programming and communications when using your Arduino, Rasperry Pi or whatever platform is in use. The only time you would HTML codes is if you are communicating to a web browser.


ASCII Table

AsciiHexSymbol
00NUL
11SOH
22STX
33ETX
44EOT
55ENQ
66ACK
77BEL
88BS
99TAB
10ALF
11BVT
12CFF
13DCR
14ESO
15FSI
AsciiHexSymbol
1610DLE
1711DC1
1812DC2
1913DC3
2014DC4
2115NAK
2216SYN
2317ETB
2418CAN
2519EM
261ASUB
271BESC
281CFS
291DGS
301ERS
311FUS
AsciiHexSymbol
3220(Space)
3321!
3422"
3523#
3624$
3725%
3826&
3927'
4028(
4129)
422A*
432B+
442C,
452D-
462E.
472F/
AsciiHexSymbol
48300
49311
50322
51333
52344
53355
53366
55377
56388
57399
583A:
593B;
603C<
613D=
623E>
633F?
AsciiHexSymbol
6440@
6541A
6642B
6743C
6844D
6945E
7046F
7147G
7248H
7349I
744AJ
754BK
764CL
774DM
784EN
794FO
AsciiHexSymbol
8050P
8151Q
8252R
8353S
8454T
8555U
8656V
8757W
8858X
8959Y
905AZ
915B[
925C\
935D]
945E^
955F_
AsciiHexSymbol
9660'
9761a
9862b
9963c
10064d
10165e
10266f
10367g
10468h
10569i
1066Aj
1076Bk
1086Cl
1096Dm
1106En
1116Fo
AsciiHexSymbol
11270p
11371q
11472r
11573s
11674t
11775u
11876v
11977w
12078x
12179y
1227Az
1237B(
1247C|
1257D)
1267E~
1277F 

Comments

Popular Posts