Discrete Mathematics Practical 8
Page 1 of 2 Oliver Hyde
Practical 8: Parity Builder
A parity bit, or check bit, is a bit added to a string of binary code to ensure that the total
number of 1-bits in the string is even or odd. Parity bits are used as a simple form of e
or
detection.
If an odd number of bits (including the parity bit) are transmitted inco
ectly, the parity bit
will be inco
ect, thus indicating that a parity e
or occu
ed in the transmission. The parity
it is only suitable for detecting e
ors; it cannot co
ect any e
ors, as there is no way to
determine which particular bit is co
upted.
Parity bit checking is sometimes used for transmitting ASCII characters, which have 7 bits,
leaving the 8th bit as a parity bit.
Even parity: the parity checking circuit counts the number of 1-bits and adds the parity bit to
make the total number of 1-bits an even number.
Prepare a Parity Builder spreadsheet (an example template is shown below). Steps involved:
❑ The user is prompted to enter a single character.
❑ Calculate the ASCII code for the character in decimal.
❑ Convert the ASCII code for the character to binary (note that ASCII codes have seven
its).
❑ Separate the binary form into its seven component bits.
❑ Calculate the parity bit using even parity (parity bit = sum of component bits mod 2).
❑ The ASCII code for transmission is the 8-bit code (7-bit ASCII code + parity bit as
shown in template).
https:
en.wikipedia.org/wiki/Bit
https:
en.wikipedia.org/wiki/Binary_code
https:
en.wikipedia.org/wiki/Even_numbe
https:
en.wikipedia.org/wiki/Odd_numbe
https:
en.wikipedia.org/wiki/Transmission_(telecommunications)
https:
en.wikipedia.org/wiki/E
or_detection_and_co
ection
https:
en.wikipedia.org/wiki/ASCII
Discrete Mathematics Practical 8
Page 2 of 2 Oliver Hyde
Important Excel functions:
• CODE(text).
• DEC2BIN(number, [places]).
• MID(text, start_num, num_chars).
• MOD(number, divisor).
Spreadsheet protection
Ensure your spreadsheet is protected (so users cannot co
upt it), no password, with only user
input cells having unlocked protection.
Submitting your Answers
❑ Create a single Excel spreadsheet named as follows: the word Practical, followed by a
space and the practical number, i..e. Practical 8.
❑ Submit the spreadsheet via Moodle by Friday before 11:55 p.m. You may only submit
once. Late submissions are not permitted.