Download as pdf or txt
Download as pdf or txt
You are on page 1of 4

Types of codes in logic

Name: Omar Mosaad Haggrass


Presented to: DR. Mohammed Nasr
Huffman coding:
Huffman coding is a lossless (i.e., keeping all information) compression algorithm
that can be used to compress lists of symbols. It’s widely used in data compression
tasks such as file archiving.
For the text “ABEACADABEA”, using ACSII code for each character, the
encoded text has 11×8=88 bits.
The Huffman encoded text has 5×1+(2+1+1+2)×3=21 bits, a significant reduction
from the original 88 bits!

Gray coding:
Gray code, is an ordering of the binary numeral system such that two successive
values differ in only one bit (binary digit).
For example, the representation of the decimal value "1" in binary would normally
be "001" and "2" would be "010". In Gray code, these values are represented as
"001" and "011". That way, incrementing a value from 1 to 2 requires only one bit
to change, instead of two.
Gray codes are widely used to prevent spurious output
from electromechanical switches and to facilitate error correction in digital
communications such as digital terrestrial television and some cable TV systems.
The use of Gray code in these devices helps simplify logic operations and reduce
errors in practice.

Excess-3 coding:

The excess-3 code is also treated as XS-3 code. The excess-3 code is a non-weighted
and self-complementary BCD code used to represent the decimal numbers. This
code has a biased representation. This code plays an important role in arithmetic
operations because it resolves deficiencies encountered when we use the 8421 BCD
code for adding two decimal digits whose sum is greater than 9. The Excess-3 code
uses a special type of algorithm, which differs from the binary positional number
system or normal non-biased BCD.

We can easily get an excess-3 code of a decimal number by simply adding 3 to each
decimal digit. And then we write the 4-bit binary number for each digit of the
decimal number. We can find the excess-3 code of the given binary number by using
the following steps:

1. We find the decimal number of the given binary number.


2. Then we add 3 in each digit of the decimal number.
3. Now, we find the binary code of each digit of the newly generated decimal
number.

BCD or Binary Coded Decimal:

BCD or Binary Coded Decimal is that number system or code which has the binary
numbers or digits to represent a decimal
number. A decimal number contains 10 digits (0-9). Now the equivalent binary
numbers can be found out of these 10 decimal numbers. In case of BCD the binary
number formed by four binary digits, will be the equivalent code for the given
decimal digits. In BCD we can use the binary number from 0000-1001 only, which
are the decimal equivalent from 0-9 respectively. Suppose if a number have single
decimal digit then it's equivalent Binary Coded Decimal will be the respective four
binary digits of that decimal number and if the number contains two decimal digits
then it's equivalent BCD will be the respective eight binary of the given decimal
number. Four for the first decimal digit and next four for the second decimal digit

ASCII coding:

ASCII stands for 'American Standard Code for Information Interchange'. It was
defined in 1963 and was one of the most common character sets used. It started by
using 7 bits to represent characters, which allowed for a maximum of 128 (2, to the
power 7 ,27) characters to be represented.

These days, 8 bits (1 byte) are used to store each character in the ASCII character
set. The original coding system remains, but each code now has a preceding 0,0.
The eighth bit was sometimes used as a parity bit for checking for errors during the
transmission of data.
When text is encoded and stored using ASCII, each of the characters is assigned a
denary (decimal) character code, which is represented and stored in the computer
as binary.

Binary coding:

Binary code, code used in digital computers, based on a binary number system in
which there are only two possible states, off and on, usually symbolized by 0 and
1. Whereas in a decimal system, which employs 10 digits, each digit position
represents a power of 10 (100, 1,000, etc.), in a binary system each digit position
represents a power of 2 (4, 8, 16, etc.). A binary code signal is a series of electrical
pulses that represent numbers, characters, and operations to be performed

Error Correction Code:

Error Correction Code (ECC) is a technique utilized in digital data transmission and
storage systems to detect and correct errors that occur during data communication or
storage. By adding redundancy to the original data, ECC enables the receiving or
reading device to identify and fix a limited number of errors. The primary purpose of
ECC is to enhance the reliability and accuracy of data transfers and storage.

You might also like