Science Fair Projects Ideas - Binary-coded decimal

All Science Fair Projects

      

Science Fair Project Encyclopedia for Schools!

  Search    Browse    Forum  Coach    Links    Editor    Help    Tell-a-Friend    Encyclopedia    Dictionary     

Science Fair Project Encyclopedia

For information on any area of science that interests you,
enter a keyword (eg. scientific method, molecule, cloud, carbohydrate etc.).
Or else, you can start by choosing any of the categories below.

Binary-coded decimal

(Redirected from Binary Coded Decimal)

Binary-coded decimal (BCD) is, after character encodings, the most common way of encoding decimal digits in computing and in electronic systems. In BCD, a digit is usually represented by four (binary) bits, of which the leftmost (written conventionally) has value 8, and the remaining three have values 4, 2, and 1. Only the combinations of these bits which, when summed, have values in the range 0-9 are valid. (Other combinations are sometimes used for sign or other indications.)

Contents

Basics

To BCD-encode a decimal number such as 127, for example, each of the decimal digits is encoded using the bit pattern for each digit, that is: 0001, 0010, 0111.

Since most computers store data in eight-bit bytes, there are two common ways of storing four-bit BCD digits in those bytes: either one can simply ignore the extra four bits of each byte, usually filling them with either zero bits or one bits (as in EBCDIC); or one can store two digits per byte, called "packed" BCD (packed BCD numbers also usually end with a sign 'digit', for which the preferred values are 1100 for + and 1101 for −). Thus the number 127 would be represented as (11110001, 11110010, 11110111) in EBCDIC or (00010010, 01111100) in packed BCD.

While BCD is wasteful (about 1/6 of the available memory is wasted, even in packed BCD), it has a direct correspondence to the ASCII character set if the BCD number is prepended with 0011 or OR'ed with 00110000 (decimal 48), and similarly maps to EBCDIC characters if the BCD code is prefixed with 1111.

Further, large numbers can easily be displayed on 7-element displays by splitting up the nybbles and sending each to a different character (the individual characters often have the wiring to display the correct figures). The BIOS in PCs usually keeps the date and time in BCD format, probably for historical reasons (it avoided the need for binary to ASCII conversion).

BCD is still in wide use, and decimal arithmetic is often carried out using BCD or similar encodings.The more the better

BCD in electronics

BCD is very common in electronic systems where a numeric value is to be displayed, especially in systems consisting solely of digital logic, and not containing a microprocessor. By utilising BCD, the manipulation of numerical data for display can be greatly simplified by treating each digit as a separate single sub-circuit. This matches much more closely the physical reality of display hardware - a designer might choose to use a series of separate identical 7-segment displays to build a metering circuit, for example. If the numeric quantity were stored and manipulated as pure binary, interfacing to such a display would require complex circuitry. By working throughout with BCD, a much simpler overall system results.

Higher-density encoding

If a decimal digit requires four bits, then three decimal digits require 12 bits. However, since 210>103, if three decimal digits are encoded together then only 10 bits are needed. Two such encodings are Chen-Ho encoding and densely packed decimal.

IBM and BCD

IBM used the terms binary-coded decimal and BCD for six-bit alphameric codes that represented numbers, upper-case letters and special characters. Some variation of BCD was used in most early IBM computers, including the IBM 1620, IBM 1400 series and non-decimal members of the IBM 700/7000 series. With the introduction of System/360, IBM replaced BCD with 8-bit EBCDIC.

Bit positions in BCD were usually labeled B, A, 8, 4, 2 and 1. For encoding digits, B and A were zero. The letter A was encoded (B,A,1).

In the 1620 BCD alphamerics were encoded using digit pairs, with the "zone" in the even digit and the "digit" in the odd digit. Input/Output translation hardware converted between the internal digit pairs and the external standard six-bit BCD codes.

Background

The binary-coded decimal scheme described in this article is the most common encoding, but there are many others. For clarity the method here can be referred to as Simple Binary-Coded Decimal (SBCD) or BCD 8421. The 8421 word indicates the bit weights in the byte.

The following table represents decimal digits from 0 to 9 in various BCD systems:

       SBCD              BCD     BCD   IBM 1401
Digit  8421   Excess-3  2421   84-2-1    8421
  0    0000    0011     0000    0000     1010
  1    0001    0100     0001    0111     0001
  2    0010    0101     0010    0110     0010
  3    0011    0110     0011    0101     0011
  4    0100    0111     0100    0100     0100
  5    0101    1000     1011    1011     0101
  6    0110    1001     1100    1010     0110
  7    0111    1010     1101    1001     0111
  8    1000    1011     1110    1000     1000
  9    1001    1100     1111    1111     1001

See also

External links

09-23-2007 01:00:40
The contents of this article is licensed from www.wikipedia.org under the GNU Free Documentation License. Click here to see the transparent copy and copyright details
Science kits, science lessons, science toys, maths toys, hobby kits, science games and books - these are some of many products that can help give your kid an edge in their science fair projects, and develop a tremendous interest in the study of science. When shopping for a science kit or other supplies, make sure that you carefully review the features and quality of the products. Compare prices by going to several online stores. Read product reviews online or refer to magazines.

Start by looking for your science kit review or science toy review. Compare prices but remember, Price $ is not everything. Quality does matter.
Science Fair Coach
What do science fair judges look out for?
ScienceHound
Science Fair Projects for students of all ages
All Science Fair Projects.com Site
All Science Fair Projects Homepage
Search | Browse | Links | From-our-Editor | Books | Help | Contact | Privacy | Disclaimer | Copyright Notice