46
SECTION
1
Introductory
Concepts
Industrial Text & Video Company 1-800-752-8398
www.industrialtext.com
Number Systems
and Codes
CHAPTER
2
ASCII
2-4 BINARY CODES
An important requirement of programmable controllers is communication
with various external devices that either supply information to the controller
or receive information from the controller. This input/output function in-
volves the transmission, manipulation, and storage of binary data that, at
some point, must be interpreted by humans. Although machines can easily
handle this binary data, we require that the data be converted to a more
interpretable form.
One way of satisfying this requirement is to assign a unique combination of
1s and 0s to each number, letter, or symbol that must be represented. This
technique is called binary coding. In general, there are two categories of
codes—those that represent numbers only and those that represent letters,
symbols, and decimal numbers.
Several codes for representing numbers, symbols, and letters are standard
throughout the industry. Among the most common are the following:
• ASCII
• BCD
• Gray
Alphanumeric codes (which use a combination of letters, symbols, and
decimal numbers) are used when information processing equipment, such as
printers and cathode ray tubes (CRTs), must process the alphabet along with
numbers and special symbols. These alphanumeric characters—26 letters
(uppercase), 10 numerals (0-9), plus mathematical and punctuation sym-
bols—can be represented using a 6-bit code (i.e., 2
6
= 64 possible characters).
The most common code for alphanumeric representation is ASCII (the
American Standard Code for Information Interchange).
An ASCII (pronounced as-kee) code can be 6, 7, or 8 bits. Although a 6-bit
code (64 possible characters) can accommodate the basic alphabet, numbers,
and special symbols, standard ASCII character sets use a 7-bit code (2
7
= 128
possible characters), which provides room for lower case and control charac-
ters, in addition to the characters already mentioned. This 7-bit code provides
all possible combinations of characters used when communicating with
peripherals and interfaces.