Assalamualaikum....dan Salam Sejahtera...

Terima kasih kerana melayari blog ini.. Blog ini wujud atas dasar ingin membantu pelajar-pelajar mendapatkan nota tambahan bagi modul ETE 315 @ Asas Sistem Berdigit. Di harapkan pelajar lebih memahami berkaitan modul ini selain daripada pnp di dalam kelas...

Mohon maaf sekiranya terdapat banyak kekurangan di dalam blog ini.. Sebarang kesalahan harap diberitahu untuk diperbetulkan...

28 Sept 2009

SISTEM KOD

Binary Coded Decimal Numbers

Another number system that is encountered occasionally is Binary Coded Decimal. In this
system, numbers are represented in a decimal form, however each decimal digit is encoded
using a four bit binary number.

For example: The decimal number 136 would be represented in BCD as follows:

136 = 0001 0011 0110
              1      3      6

Conversion of numbers between decimal and BCD is quite simple. To convert from decimal to
BCD,  simply write down the four bit binary pattern for each decimal digit. To convert from BCD to decimal, divide the number into groups of 4 bits and write down the corresponding decimal digit for each 4 bit group.

There are a couple of variations on the BCD representation, namely packed and unpacked. An
unpacked BCD number has only a single decimal digit stored in each data byte. In this case, the
decimal digit will be in the low four bits and the upper 4 bits of the byte will be 0. In the packed
BCD representation, two decimal digits are placed in each byte. Generally, the high order bits of
the data byte contain the more significant decimal digit.

An example:

The following is a 16 bit number encoded in packed BCD format:

01010110 10010011

This is converted to a decimal number as follows:

0101  0110  1001  0011
  5         6        9       3

The value is 5693 decimal

Another example:

The same number in unpacked BCD (requires 32 bits)

00000101   00000110   00001001  00000011
       5                6                9                 3

The use of BCD to represent numbers isn’t as common as binary in most computer systems, as it
is not as space efficient. In packed BCD, only 10 of the 16 possible bit patterns in each 4 bit unit
are used. In unpacked BCD, only 10 of the 256 possible bit patterns in each byte are used.


BCD Digits
0 ................ 0000
1 ................ 0001
2 ................ 0010
3 ................ 0011
4 ................ 0100
5 ................ 0101
6 ................ 0110
7 ................ 0111
8 ................ 1000
9 ................ 1001

 Ok.. That's entry for today, I'll bee continue topic  addition and subtraction for next entry..