Thanks to visit codestin.com
Credit goes to www.scribd.com

0% found this document useful (0 votes)
28 views21 pages

2210 Computer Science: Data Transmission - Methods of Error Detection

Uploaded by

sherdil1070
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)
28 views21 pages

2210 Computer Science: Data Transmission - Methods of Error Detection

Uploaded by

sherdil1070
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/ 21

2210 Computer Science

BSS CSBC, Lahore

Data Transmission – Methods of


Error Detection
Learning Outcomes:
⁃ Understand the need to check for errors after data transmission and how these errors
can occur.
⁃ Describe the processes involved in error detection methods.
⁃ Describe how a check digit is used to detect errors in data entry including ISBN
numbers and bar codes.
⁃ Describe how an automatic repeat request (ARQ) can be used to establish that data is
received without error.
* Computer Science (2210) - BSS - CSBC 1
Data Transmission – Methods of Error Detection
The need to check for errors:
– When data is transmitted, there is always a risk that it may be corrupted,
lost or even gained.
– Errors can occur during data transmission due to:
– interference (all types of cable can suffer from electrical interference, which
can cause data to be corrupted or even lost)
– problems during packet switching (this can lead to data loss - or it is even
possible to gain data!)
– skewing of data (this occurs during parallel data transmission and can
cause data corruption if the bits arrive out of synchronisation).
– There are a number of ways data can be checked for errors following
transmission:
• parity checks
• checksum
• echo check
* Computer Science (2210) - BSS - CSBC 2
Data Transmission – Methods of Error Detection
Parity Check:
– Parity checking is one method used to check whether data has been changed
or corrupted following data transmission. This method is based on the number
of 1-bits in a byte of data.
– The parity can be either called EVEN (that is, an even number of 1-bits in the
byte)
–ODD (that is, an odd number of 1-bits in the byte). One of the bits in the byte
(usually the most significant bit or left-most bit) is reserved for a parity bit. The
parity bit is set according to whether the parity being used is even or odd.

* Computer Science (2210) - BSS - CSBC 3


Data Transmission – Methods of Error Detection
Parity Check:
– if the byte is using even parity, then the parity bit needs to be set to 0, since
there is already an even number of 1-bits in the byte (four 1-bits).

– if the byte is using odd parity, then the parity bit needs to be set to 1, since we
need to have an odd number of 1-bits in the byte.

–Before data is transferred, an agreement is made between sender and receiver


regarding which type of parity is being used.

* Computer Science (2210) - BSS - CSBC 4


Data Transmission – Methods of Error Detection
Parity Check:
– If a byte has been transmitted from 'A' to 'B', and if even parity is used, an
error would be flagged if the byte now had an odd number of 1-bits at the
receiver's end.

– In this case, the byte received has three 1-bits, which means it now has odd
parity; while the sender's byte was using even parity (four 1-bits). This means
an error has occurred during the transmission of the byte. The error is detected
by the recipient's computer re-calculating the parity of the byte sent. If even
parity had been agreed between sender and receiver, then a change in parity in
the received byte indicates that a transmission error has occurred.
* Computer Science (2210) - BSS - CSBC 5
Data Transmission – Methods of Error Detection
Problems with Parity Check: Transposition of Bits
– Nine bytes of data have been transmitted. Agreement has been made that even
parity will be used. Another byte, known as the parity byte, has also been sent.
This byte consists entirely of the parity bits produced by the vertical parity
check. The parity byte also indicates the end of the block of data.
– Table shows how the data arrived at the receiving end. It is now necessary to
check the parity of each byte horizontally (bytes 1 to 9) and vertically (columns
1 to 8). Each row and column where the parity has changed from even to odd
should be flagged:

* Computer Science (2210) - BSS - CSBC 6


Data Transmission – Methods of Error Detection
Problems with Parity Check: Transposition of Bits

–byte 8 (row 8) now has incorrect parity (there are three 1-bits)
–bit 5 (column 5) also now has incorrect parity (there are five 1-bits).

* Computer Science (2210) - BSS - CSBC 7


Data Transmission – Methods of Error Detection
Checksum:
– A checksum is a method used to check if data has been changed or corrupted
following data transmission. Data is sent in blocks, and an additional value,
called the checksum, is sent at the end of the block of data.
The checksum process is as follows:
–when a block of data is about to be transmitted, the checksum is calculated
from the block of data
–the calculation is done using an agreed algorithm (this algorithm has been
agreed by sender and receiver)
–the checksum is then transmitted with the block of data
–at the receiving end, the checksum is recalculated by the computer using the
block of data (the agreed algorithm is used to find the checksum)
–the re-calculated checksum is then compared to the checksum sent with the
data block

* Computer Science (2210) - BSS - CSBC 8


Data Transmission – Methods of Error Detection
Checksum:
– if the two checksums are the same, then no transmission errors have occurred;
otherwise a request is made to re-send the block of data
–the re-calculated checksum is then compared to the checksum sent with the
data block
– if the two checksums are the same, then no transmission errors have occurred;
otherwise a request is made to re-send the block of data

* Computer Science (2210) - BSS - CSBC 9


Data Transmission – Methods of Error Detection
Echo Check:
–when data is sent to another device, this data is sent back again, to the sender.
The sender's computer compares the two sets of data to check if any errors
occurred during the transmission process.
–If the two sets of data are different, it isn't known whether the error occurred
when sending the data in the first place, or if the error occurred when sending
the data back for checking.
– However, if no errors occurred, then it is another way to check that the data
was transmitted correctly.
–a copy of the data is sent back to the sender
–the returned data is compared with the original data by the sender's computer
–if there are no differences, then the data was sent without error
– if the two sets of data are different, then an error occurred at some stage
during the data transmission

* Computer Science (2210) - BSS - CSBC 10


Data Transmission – Methods of Error Detection
Echo Check:

* Computer Science (2210) - BSS - CSBC 11


Data Transmission – Methods of Error Detection
Check Digits:
–A check digit is the final digit included in a code; it is calculated from all the
other digits in the code. Check digits are used for barcodes on products, such
as International Standard Book Numbers (ISBN) and Vehicle Identification
Numbers (VIN). Check digits are used to identify errors in data entry caused
by mis-typing or mis-scanning a barcode. They can usually detect the following
types of error:
–an incorrect digit entered, for example 5327 entered instead of 5307
–transposition errors where two numbers have changed order, for example 5037
instead of 5307
–omitted or extra digits, for example 537 instead of 5307 or 53107 instead
–of 5307
–phonetic errors, for example 13 (thirteen), instead of 30 (thirty).

* Computer Science (2210) - BSS - CSBC 12


Data Transmission – Methods of Error Detection
Check Digits:

Sample barcode (ISBN 13 code with check digit)


– There are a number of different methods used to generate a check digit. Two
common methods will be considered here:
–ISBN 13
–Modulo-11

* Computer Science (2210) - BSS - CSBC 13


Data Transmission – Methods of Error Detection
ISBN Example: Calculation 1 - Generation of the check digit from the other
12 digits in a number
–The following algorithm generates the check digit from the 12 other digits:
–add all the odd numbered digits together
–add all the even numbered digits together and multiply the result by 3
–add the results from 1 and 2 together and divide by 10
–take the remainder, if it is zero then use this value, otherwise subtract the
remainder from 10 to find the check digit.
– Using the ISBN 978034098382
– 9+8+3+0+8+8=36
–3 x (7 + 0 + 4 + 9 + 3 +2) = 75
– (36 + 75) / 10 = 111/10 = 11 remainder 1
–10 - 1 = 9 the check digit

* Computer Science (2210) - BSS - CSBC 14


Data Transmission – Methods of Error Detection
ISBN Example: Calculation 2 - Re-calculation of the check digit from the
thirteen-digit number
–To check that an ISBN 13-digit code is correct, including its check digit, a
similar process is followed:
–add all the odd numbered digits together, including the check digit
–add all the even number of digits together and multiply the result by 3
–add the results from 1 and 2 together and divide by 10
–the number is correct if the remainder is zero.
– Using the ISBN 9780340983829 (including its check digit) from Figure
–9+8+3+0+8+8+9=45
–3 x (7 + 0 + 4 + 9 + 3 + 21 = 75
–(45 + 75) / 10 = 120/10 = 12 remainder 0
–remainder is 0, therefore number is correct.

* Computer Science (2210) - BSS - CSBC 15


Data Transmission – Methods of Error Detection
Modulo-11 Example: Calculation 1 - Generation of the check digit from
the other digits in a number
–The following algorithm generates the check digit from the other 7 digits:
–each digit in the number is given a weighting of 8, 7, 6. 5, 4, 3 or 2 starting
from the left (weightings start from 8 since the number will become eight-digit
when the check digit is added)
–the digit is multiplied by its weighting and then each value is added to make a
total
–the total is divided by 11
– 4 the remainder is then subtracted from 11 to find the check digit (note if the
remainder is 10 then the check digit ’X’ is used).

* Computer Science (2210) - BSS - CSBC 16


Data Transmission – Methods of Error Detection
Modulo-11 Example: Calculation 1 - Generation of the check digit from
the other digits in a number
–The example to be used has the following seven-digit number:
– 7-digit number: 4 1 5 6 7 1 0
– weighting values: 8 7 6 5 4 3 2
–sum: (8 x 4) + (7 x 1) + (6 x 5) + (5 x 6) + (4 x 7) + (3 x 1| + (2 x 0)
= 32 + 7 + 30 + 30 + 28 + 3 + 0
total = 130
–divide total by 11: 130/11 = 11 remainder 9
–subtract remainder from 11:11-9 = 2 (check digit)
–So we end up with the following eight-digit: 4 1 5 6 7 1 0 2

* Computer Science (2210) - BSS - CSBC 17


Data Transmission – Methods of Error Detection
Modulo-11 Example: Calculation 2 - Re-calculation of the check digit
from the eight-digit number (which now includes the check digit)
–To check that the eight-digit number is correct, including its check digit, a
similar process is followed:
–each digit in the number is given a weighting of 8. 7, 6, 5, 4, 3, 2 or 1 starting
from the left
–the digit is multiplied by its weighting and then each value is added to make a
total
–the total is divided by 11
–the number is correct if the remainder is zero

* Computer Science (2210) - BSS - CSBC 18


Data Transmission – Methods of Error Detection
Modulo-11 Example: Calculation 2 - Re-calculation of the check digit
from the eight-digit number (which now includes the check digit)
–Using the 8-digit number: 4 1 5 6 7 1 0 2
–weighting values: 87654321
–sum:(8 x 4) + (7 x 1) + (6 x 5) + (5 x 6) + (4 x 7) + (3 x 1) + (2 x 0) + (1 x 2) =
32 + 7+ 30 + 30 + 28 +3 + 0+ 2
– total = 132
–divide total by 11: 132/11 = 12 remainder 0
–remainder is 0, therefore number is correct

* Computer Science (2210) - BSS - CSBC 19


Data Transmission – Methods of Error Detection
Automatic Repeat Requests (ARQs)
–An Automatic Repeat Request (ARQ) is a third way used to check data
following data transmission. This method can best be summarised as follows:
–ARQ uses positive and negative acknowledgements (messages sent to the
receiver indicating that data has/has not been received correctly) and timeout
(this is the time interval allowed to elapse before an acknowledgement is
received)
–the receiving device receives an error detection code as part of the data
transmission this is used to detect whether the received data contains any
transmission errors
–if no error is detected, a positive acknowledgement is sent back to the sending
device
–however, if an error is detected, the receiving device now sends a negative
acknowledgement to the sending device and requests re-transmission of the
data

* Computer Science (2210) - BSS - CSBC 20


Data Transmission – Methods of Error Detection
Automatic Repeat Requests (ARQs)
–a time-out is used by the sending device by waiting a pre-determined amount of
time .
–and if no acknowledgement of any type has been received by the sending device
within this time limit, it automatically re-sends the data until a positive
acknowledgement is received ....
–or until a pre-determined number of re-transmissions has taken place
–ARQ is often used by mobile phone networks to guarantee data integrity.

* Computer Science (2210) - BSS - CSBC 21

You might also like