Digital Circuit Design with an Introduction to CPLDs and FPGAs

Chapter 4: Binary Codes

Overview

This chapter describes the most commonly used binary codes. In particular, we will discuss the Binary Coded Decimal (BCD), the Excess-3 Code, the 2*421 Code, the Gray Code, and the American Standard Code for Information Interchange (ASCII) code. We will also discuss parity bits.

4.1 Encoding

In general, encoding is the process of putting a message into a code. In this text, encoding will refer to a process where the decimal numbering system as well as other alphanumerics (combinations of numbers and letters) are represented by the digits of the binary numbering system, that is 0 and 1. In this section we will introduce four different codes where 4 bits are used to represent a single decimal character.

4.1.1 Binary Coded Decimal (BCD)

The Binary Coded Decimal (BCD) uses 4 bits to represent the decimal numbers 0 through 9 and these are shown in the Table 4.1. This code is also known as 8421 code because the digits 8, 4, 2 , and 1 represent the weight of its bits position. In other words, the BCD is a weighted code.

Table 4.1: The BCD code

Decimal

BCD

0

0000

1

0001

2

0010

3

0011

4

0100

5

0101

6

0110

7

0111

8

1000

9

1001

We observe that only ten of the sixteen (2 4) possible combinations are used in BCD; the remaining six combinations 1010, 1011, 1100, 1101, 1110, and 1111 are invalid in BCD. The designations A through F to represent...