ASCII

Pages
Contributors: Shawn Hymel
Favorited Favorite 30

Introduction

If computers operate in binary, then how are we able to store letters and words? To do this, we assign numbers to characters. This is known as character encoding.

Example of ASCII encoding

Looking at the internals of a simple text document

To understand how character encoding works, let's create a simple example. First, assign the numbers 1-26 to the English alphabet:

1  2  3  4  5  6  7  8  9  10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
a  b  c  d  e  f  g  h  i  j  k  l  m  n  o  p  q  r  s  t  u  v  w  x  y  z

To write a simple encoded message, we substitute the numbers for the letters. For example, 8 5 12 12 15. By using numbers, we have constructed the word h e l l o.

But to completely capture the English alphabet -- including upper and lower-case letters, numbers, and punctuation -- we needed more than 26 characters. As a result, the American Standard Code for Information Interchange (ASCII) was created as one of the first character encoding standards for computers.

What You Will Learn

The following topics will be covered in this tutorial:

  • A brief history of ASCII
  • How to translate decimal, binary, and hexadecimal numbers to ASCII

Suggested Reading

There are a few concepts that you might want to be familiar with before starting to read this guide:

  • Binary - Knowing how a computer stores numbers is useful to translating those numbers to characters.
  • Hexadecimal - Hexadecimal is often used to express binary numbers in groups of 4 bits.
  • Installing Arduino IDE - Arduino is a good way to try printing ASCII characters.