0% found this document useful (0 votes)
27 views37 pages

Unit-4 DC Notes

unit 4 data communication notes

Uploaded by

Gokul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views37 pages

Unit-4 DC Notes

unit 4 data communication notes

Uploaded by

Gokul
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 37

Hamming Code:

Hamming code is an error-correcting code used to ensure data accuracy during


transmission. Hamming code detects and corrects the errors that can occur. It helps to improve
the reliability of communication systems and digital storage. It adds extra bits (redundant bits)
to the original data, allowing the system to detect and correct single-bit errors. Redundant bits
are extra binary bits that are generated and added to the information-carrying bits of data
transfer to ensure that no bits were lost during the data transfer. The number of redundant bits
can be calculated using the following formula:
2R ≥ R + M + 1
where M is the number of bits in input data, and R is the number of redundant bits. In
hamming code, parity bits are used as redundant bits for easier error detection.
Algorithm of Hamming Code
Step 1: Write the bit positions starting from 1 from right to left.
Step 2: All the bit positions that are a power of 2 are marked as parity bits (1, 2, 4, 8, etc).
Step 3: All the other bit positions are marked as data bits.
Step 4: Each data bit is included in a unique set of parity bits, as determined by its bit position
in binary form:
 a. Parity bit 1 covers all the bits positions whose binary representation includes a 1 in
the least significant position (1, 3, 5, 7, 9, 11, etc).
 b. Parity bit 2 covers all the bits positions whose binary representation includes a 1 in
the second position from the least significant bit (2, 3, 6, 7, 10, 11, etc).
 c. Parity bit 4 covers all the bits positions whose binary representation includes a 1 in
the third position from the least significant bit (4–7, 12–15, 20–23, etc).
 d. Parity bit 8 covers all the bits positions whose binary representation includes a 1 in
the fourth position from the least significant bit bits (8–15, 24–31, 40–47, etc).
Step 5: Since we check for even parity set a parity bit to 1 if the total number of ones in the
positions it checks is odd. Set a parity bit to 0 if the total number of ones in the positions it
checks is even.
Example: Construct the even parity Hamming code word for a data byte 1001101.
The number (1001101) of bits is 7.
The value of R is calculated as:
2𝑅 ≥ 𝑀 + 𝑅 + 1
Let R=1, ⇒ 21 ≥ 1 + 7 + 1 => 2 ≥ 9 (False)
Let R=2, ⇒ 22 ≥ 2 + 7 + 1 => 4 ≥ 10 (False)
Let R=3, ⇒ 23 ≥ 3 + 7 + 1 => 8 ≥ 11 (False)
Let R=4, ⇒ 24 ≥ 4 + 7 + 1 => 16 ≥ 12 (True)
Therefore, the number of redundancy bits = 4.
The positions of parity bits are 20 = 1, 21 = 2, 22 = 4, 23 = 8 and the parity bits are P1, P2, P4,
and P8.
The hamming code format is
Bit positions 11 10 9 8 7 6 5 4 3 2 1
Bit number b11 b10 b9 P8 b7 b6 b5 P4 b3 P2 P1
Data 1 0 0 1 1 0 1

P1 b3 b5 b7 b9 b11
To find P1
1 1 0 1 0 1
P2 b3 b6 b7 b10 b11
To find P2
0 1 1 1 0 1
P4 b5 b6 b7
To find P4
0 0 1 1
P8 b9 b10 b11
To find P8
1 0 0 1
The hamming code inserted is P8P4P2P1: 1001
The transmitted data is: 10011100101
At the receiver side, let the data received is 10111100101.
Bit positions 11 10 9 8 7 6 5 4 3 2 1
Bit number b11 b10 b9 P8 b7 b6 b5 P4 b3 P2 P1
Received Data 1 0 1 1 1 1 0 0 1 0 1
Check for the even parity for all parity bits for the received data:
Parity
P1 b3 b5 b7 b9 b11
For P1 value
1 1 0 1 1 1 1
P2 b3 b6 b7 b10 b11
For P2
0 1 1 1 0 1 0
P4 b5 b6 b7
For P4
0 0 1 1 0
To find P8 b9 b10 b11
P8 1 1 0 1 1
The parity value P8P4P2P1: 1001 indicates that the received data contains error in position 9
i.e., b9.
So, the data in position 9 is modified and sent to the destination as 1001101.
Features of Hamming Code
 Error Detection and Correction: Hamming code is designed to detect and correct
single-bit errors that may occur during the transmission of data. This ensures that the
recipient receives the same data that was transmitted by the sender.
 Redundancy: Hamming code uses redundant bits to add additional information to the
data being transmitted. This redundancy allows the recipient to detect and correct errors
that may have occurred during transmission.
 Efficiency: Hamming code is a relatively simple and efficient error-correction
technique that does not require a lot of computational resources. This makes it ideal for
use in low-power and low-bandwidth communication networks.
 Widely Used: Hamming code is a widely used error-correction technique and is used
in a variety of applications, including telecommunications, computer networks, and
data storage systems.
 Single Error Correction: Hamming code is capable of correcting a single-bit error,
which makes it ideal for use in applications where errors are likely to occur due to
external factors such as electromagnetic interference.
 Limited Multiple Error Correction: Hamming code can only correct a limited
number of multiple errors. In applications where multiple errors are likely to occur,
more advanced error-correction techniques may be required.

Character Synchronization:
Character synchronization involves identifying the beginning and end of a character
within a message. In data communications circuits, there are two formats commonly used to
achieve character synchronization: asynchronous and synchronous.
Asynchronous Character Synchronization:
Asynchronous data transmission is sometimes called start-stop transmission because
each data character is framed between start and stop bits. The start and stop bits identify the
beginning and end of the character, so the time gaps between characters do not present a
problem. For asynchronously transmitted serial data, framing characters individually with start
and stop bits is sometimes said to occur on a character-by-character basis.
The first bit transmitted is the start bit, which is always a logic 0, because an idle line
condition (no data transmission) on a data communications circuit is identified by the
transmission of continuous logic 1s (called idle line 1s). The character bits are transmitted next,
beginning with the LSB and ending with the MSB. The data character can contain between five
and eight bits. The parity bit (if used) is transmitted directly after the MSB of the character.
The last bit transmitted is the stop bit, which is always a logic 1, which guarantees a high-to-
low transition at the beginning of each character and there can be either one, one and a half, or
two stop bits. Therefore, a data character may be comprised of between seven and 11 bits.
It is not necessary that the transmit and receive clocks be continuously synchronized;
but their frequencies should be close, and they should be synchronized at the beginning of each
character. When the transmit and receive clocks are substantially different, a condition called
clock slippage may occur. If the transmit clock is substantially lower than the receive clock,
under-slipping occurs. If the transmit clock is substantially higher than the receive clock, a
condition called over-slipping occurs. This is used for transmitting shorter messages.
Example: For the following sequence of bits, identify the ASCII-encoded character, the start
and stop bits, and the parity bits (assume even parity and two stop bits):

Sol:
Synchronous Character Synchronization:
It involves transporting serial data at relatively high speeds in groups of characters called
blocks or frames. A message is composed or formulated and then the entire message is
transmitted as a single entity with no time lapses between characters. In this a SYN character
is transmitted at the beginning of each message. The SYN character is 16 hex in ASCII code.
Once the receiver detects one or more SYN characters, the receiver clocks in the next eight bits
and interprets them as the first character of the message. The receiver continues clocking in
bits, interpreting them in groups of eight until it receives another unique character that signifies
the end of the message. The end-of-message character varies with the type of protocol being
used and what type of message it is associated with. With synchronous data, the transmit and
receive clocks must be synchronized because character synchronization occurs only once at the
beginning of a message. So, this is used for transmitting long messages.
Example: For the following string of ASCII-encoded characters, identify each character
(assume odd parity):

Sol:

You might also like