Vocademy

Binary-coded information

Roman signaling

Using machines to store or convey information is nothing new. The ancient Romans developed a signaling system using racks of flags on poles. Each rack had five poles, and each signal station had two racks. The alphabet was written in a five-by-five grid to encode information with each letter in one of the squares. One rack represented a grid column, and the other a grid row. Signalers raised the appropriate number of flags on each rack to indicate a letter of the alphabet. Using the modern English alphabet as an example, the numbers 1 and 1 would represent the letter A. The numbers 1 and 2 would represent the letter B. The numbers 2 and 1 would represent the letter F, etc. This system could handle an alphabet with 25 letters, and it would take several seconds to send each letter.

Schematic of Roman signal flags showing three flags up on the left rack and two flags up on the right rack.

  1
O
5 V W X Y Z

Using this matrix, row 2 and column 3 encode the flags as the letter "H"

This is one of the earliest known examples of binary-coded information. It was binary—meaning to have two states—because each flag could be raised or not (two possibilities). This type of binary coding is similar to how text information is encoded in computers today.

A Modern Twist on Roman Signaling

The American Standard Code for Information Interchange (ASCII) encodes text information in countries that use alphabets similar to the English alphabet. To see how ASCII is similar to Roman signaling, imagine the racks of flags as having four flags each. Instead of raising from 1, 2, 3, or 4 flags, any flag can be up or down regardless of the other flags. With four flags, there are 16 possible flag-up and flag-down combinations. With two racks of four flags each, you could represent 16 rows and 16 columns of a table. This makes a table with 256 squares. That is enough to represent every letter of the alphabet (both upper and lowercase), the numerals 0 through 9, punctuation, and common symbols. That uses less than half of the available squares in the table. This is precisely how ASCII is encoded.

Schematic of a system like the Roman system using the modern ASCII code. The left rack has the flags set at: down, up, down, down; and the right rack has the flags set at: down, down, down, up.

  ---- ---|  --|-  --||  -|--  -|-| -||-
----     space  P '
---|      ! Q a
--|-     2 R b
--||     3 C S c
-|--     $ 4 D T d
-|-|     % 5 E U e

This is part of the ASCII code table using flag indicators instead of numerical codes. A hyphen (-) represents flag-down. Uppercase I represents flag-up. Using the ASCII code, the flags represent the upper-case letter A (-I-- ---I).

Giving Meaning to Encoded Information

No encoded information has meaning until two or more people agree on what it means.[1] The Roman signal corps had to know what the flags meant. In the case of ASCII, companies that operated Teleprinter services agreed about the meaning of the code. When Teleprinters were attached to computers, ASCII became the defacto code for computers to represent text.

Morse Code

Another example of a binary code is Morse code. You are already familiar with the dots and dashes used in Morse Code to represent letters of the alphabet. Morse Code is binary because there are two possibilities: dots or dashes. In modern terms, we would call this pulse width keying (dots vs. dashes) combined with pulse coding (different groupings of dots and dashes) to represent text. Morse code was originally intended to operate mechanical readers. These would mark a string of dots and dashes on paper tape. However, the operators found it more efficient to listen to the code and write the characters as they were received. Morse Code was used with early telegraphs and later radiotelegraphs.

Paul Revere

A famous use of binary-coded information involved Paul Revere. Preceding the battles of Lexington and Concord in the American Revolutionary War, Paul Revere was charged with warning John Hancock and Samuel Adams when the Royal Army moved upon Lexington. On the night of April 18, when the armies were expected to move, Revere was stationed in Charleston, where he could watch for a signal from the Old North Church in Boston. By previous agreement with Robert Newman, the sexton of the church, Newman would place a single lantern in a window of the church tower if the army took an overland route. If the army crossed the Charles River instead, he would put two lanterns in the tower (one if by land, two if by sea).

Once again, we have a binary code used to convey information. In this case, to make the code meaningful, Revere, Newman, William Dawes (Revere's backup rider, who took a different route in case Revere was captured), and a few people in Charleston knew what the code meant. In this case, the two states consisted of lanterns, each of which could be shown or not shown.   

A data-good indicator

All communication systems need something to indicate when the data is good. For example, let’s say Robert Newman intended to signal that the Royal Army was crossing the Charles River. First, he puts up one lantern, then a second. In the meantime, Revere and Dawes see the first lantern and then ride off with the message that the Royal Army is taking the overland route. They needed an agreement to prevent such a mistake. Newman could have placed both lanterns in the window at once if that were the correct signal. Revere and Dawes could have waited a short time to be sure Newman was finished. Nevertheless, something needed to indicate when the information was valid. Electronic information systems (computers, teleprinters, etc.) also need such a data-good indicator. This may be a “clock” signal on a separate wire or another method that will be discussed when appropriate.

Bits, bytes, binary numbers and hexadecimal numbers

Today, binary coded information is ubiquitous, and we have the terminology to label the methods used to encode it. Now we can learn some language that will help explain the history of information machines.

Bits

With the Roman signaling, each flag could be in one of two states, up or down. With Robert Neuman's lanterns, there could be two possible states, one lantern or two. The modern name for one of these one-of-two pieces of information is a bit. Anything that can have one of two discreet states can carry one bit of information: a flag, a pair of lanterns, an electric light, fingers (up or down), etc. The meaning of a bit of information can be anything that two people agree upon: yes/no, true/false, on/off, up/down, by land/by sea, etc.

Binary numbers

With computers, there are many mechanisms to hold binary information. Using terms like on and off, charged and discharged, positive and negative becomes cumbersome. People who work with computers most-often use the numbers 1 and 0 to represent the two states of any binary device. This way, the actual mechanism does not have to be known; only the information that is conveyed by the mechanism. The binary number system was invented to communicate the states of binary devices. The binary number system has only two numbers, 1 and 0. However, you can use multiple binary digits to convey more than just two possibilities. The following chart shows how to communicate 16 different states using a group of four bits. It shows the decimal numbers from 0 to 15 represented by the binary numbers from 0000 to 1111

0 0000   8 1000
1 0001   9 1001
2 0010 10 1010
3 0011   11 1011
4 0100   12 1100
5 0101   13 1101
6 0110   14 1110
7 0111   15 1111
         
First 16 binary numbers (0 - 15 decimal)

Keep in mind that computers don't use binary numbers. Computers are machines with many mechanisms that can convey binary-coded information, but there are no numerals in a computer. People use binary numbers to model the mechanisms in computers and more-easily communicate the information to other people. The binary number system is simply a shorthand for the actual states of the mechanisms.

Roman Signal Flags Indicating Binary Numbers

Here is an example of how binary numbers can be used to model a binary mechanism. With the Roman signaling, let's say that when a flag is down, it represents the binary number 0, and when a flag is up, it represents the binary number 1. With this code, three flags up and two flags down would be represented by 11100. If you had to write down the states of the flags, would you rather write, "up, up, up, down, down" or "11100?" I think you will agree that using binary digits are much easier. 

0100

0001

Here are the Roman flags used to represent binary numbers. Flag-down is 0, and flag-up is 1.

  0000 0001 0010 0011 0100  0101 0110
0000     space  P '
0001     ! Q a
0010     2 R b
0011     3 C S c
0100     $ 4 D T d
0101     % 5 E U e

Now the table encodes the ASCII code with binary numbers.

Bytes

Binary computers work on groups of bits. Traditionally, the number of bits that a particular computer works on at one time, whether that be four bits, seven bits, eight bits, 16 bits, etc., was called a byte. However, since the late 1970s, a byte always refers to eight bits (except in some historical contexts).

Words

The term "word" has also gone through some evolution. After the term "byte" was standardized to mean eight bits, the term "word" became the number of bits that a particular system works on at one time. However, in some contexts, the term "word" always represents two bites. In those contexts, four bytes is called a long word or doubleword, and eight bytes is a very long word or a quadword.

Nybbles

Some systems work on four bits (a half byte) at a time, so we need a name for this size of grouping. Therefore, a nybble is four bits.

Kilobytes, Megabytes, etc.

In the metric system, the prefix "kilo" represents a factor of 1,000. In other words, a kilometer (a kilo-meter) is 1,000 meters. In electronics, a kilovolt is 1,000 volts, etc. However, 1,000 is a power of 10. Computers tend to group numbers in powers of 2. The nearest power of 2 to 1,000 is 1,024. Therefore, in the context of computers, a kilobyte is 1,024 bytes, not 1,000 bytes.

Marketing Confusion

This grouping in powers of 2 has caused some confusion among some not-so-tech-savvy consumers. Manufacturers market mass storage devices (hard drives and flash memory, etc.) in powers of 10 where computers divide such devices using powers of 2. Therefore, 1 kilobyte of hard disk space (according to the retail box) shows up as 976 bytes in the computer. Consumers sometimes think they are being shorted by about 2.4% when they buy mass storage devices. There have been class-action lawsuits, lawyers have made a lot of money and consumers have gotten discount coupons, but nothing has changed. Mass storage is still marketed in powers of 10.

In 1999, the International Electrotechnical Commission established a new term for use with powers of 2. This is the kilo-binary byte or kibibyte, abbreviated as kiB. This has not been universally adapted so you must be careful to understand the context when prefixes are used.

In decimal quantities 1,000 x 1,000 is 1,000,000 or one million. In metric systems, the prefix Mega is used to represent a factor of 1,000,000. As you probably expect, in computers, the prefix Mega is used for 1,024 x 1,024. In other words, a megabyte equals 1,024 kilobytes. More precisely, 1 MiB is 1,024 kiB. This continues as necessary, as shown below:

8 bits = 1 byte
1,024 bytes = 1 kilobyte or 1 kiB
1,024 kiB = 1 Megabyte or 1 MiB
1,024 MiB = 1 Gigabyte or 1 GiB
1,024 GiB = 1 Terabyte or 1 TiB

Bits, bytes, kilobytes, etc

Hexadecimal numbers

Although binary numbers make a convenient shorthand for information as stored and conveyed by computers, they in themselves can become unwieldy. Long strings of binary numbers can be cumbersome to write or read. To make noting binary numbers a bit easier we use yet another number system called hexadecimal.

Hexadecimal numbers uses 16 digits. This is six more than we are accustomed to with the decimal system. To make up the extra six digits, we use the letters A, B, C, D, E, and F as numbers. the following table shows the 16 hexadecimal digits along with their binary counterparts.

 

0 0000   8 1000
1 0001   9 1001
2 0010 A 1010
3 0011   B 1011
4 0100   C 1100
5 0101   D 1101
6 0110   E 1110
7 0111   F 1111
         
The First 16 binary numbers (0 - F) with their binary counterparts.

It takes only a short time to learn to convert between binary and hexadecimal. All you do is break your binary number into groups of four (adding leading zeros if necessary). Next, you refer to the above chart to convert each group to hexadecimal. For example:

1101010110100110
A 16-bit binary number.
  
  1101 | 0101 | 1010 | 0110
 D   |  5   |  A   |  6
Beak into groups of 4 and convert each group.

With a little practice, it becomes much easier to write D5A6 than 1101010110100110.


What the Romans Did for Us
—————————
1You could argue that only one person has to agree on the meaning for a personal code.
Vocademy