View the step-by-step solution to:

Assignment 6: Data Checking - Version 1 EE312 - The University of Texas at Austin - Spring 2010 Assigned: Program Due: Total Value: Thursday, April 8...

In standard C (C89) You will write a parity and checksum detection program that takes a coded binary file as input,
examines the bytes for validity (even parity), and also examines each line for validity (checksum).
Your program should write the decoded text of the input binary file to the screen, so that it may be
viewed, along with indicators of the corrupted data that was found. After all the data in the file has
been processed, your program should report how many corrupted characters and lines were found in
that file.

Input Requirements:
You are given a binary file on the BB that you may assume has already been transmitted to your
computer, and which was coded for error detection. It contains redundant information to be analyzed
to help find what data may have been corrupted on transmission. It has even parity for each byte and
also a 16 bit checksum value after each new line in the file. Read from "CodedText" as a binary file.

Process Requirements:
You must check the parity of each byte, and then extract the character of text from the byte. Whenever
a new line character is found, read in the next two bytes of data as an unsigned short int which contains
the recorded checksum value for that line. Also you will need to find the sum of the ASCII values of
all characters on that line (including the parity bits and the new line character). Thus you will have the
checksum_from_file and the checksum_as_calculated. These will need to be compared to see if you
have a corrupted line. You may assume that the new line characters have not been corrupted.

Output Requirements:
For each input line along with the checksum value there are 3 possible output cases that you must
handle: In all cases you will need to strip out the parity bits and the checksum value before you output
that line to the screen.
Assignment 6: Data Checking – Version 1 EE312 – The University of Texas at Austin – Spring 2010 Assigned: Thursday, April 8 Program Due: Thursday, April 22 , before 11:59PM Total Value: 20 points total (see Deliverables below for details). Purpose Learn more about bit and byte level manipulation techniques in C, and learn how to read from binary files Deliverables Your design is not a required deliverable on this assignment. However, you are strongly encouraged to create a design and have it checked by a TA before you start coding. I also have instructed the TA’s that if you come to them with a logic problem, the TA must ask to see your design, and if you do not have one the TA is not allowed to help you. The code deliverable will be submitted through the BB assignment manager as usual. It will be a file named assign6.c that contains all the source code, header block and appropriate comments that meet the requirements for this assignment. Your code must also conform to the class C coding standards (on the Blackboard). Background Inside your PC, millions of electrical signals, traveling at nearly the speed of light, are sent and received every second. Every minute, bits by the billions flow among your computer's CPU, RAM, static RAM (SRAM), adapter cards and peripheral devices. The complexity of this traffic is beyond human comprehension. Ever wonder what would happen if any of this data were somehow garbled during transmission? These are called data errors which make programs crash or behave erratically, and can cause your computer to display almost every error message in its repertoire. These data errors can be detected by techniques that use redundant information that has been added to the transmitted units so that it may be verified. Parity checking - The simplest form of data error detection is called parity checking, which requires that each stored byte of data carry an extra bit, called the parity bit. In the even parity scheme, the byte's original seven data bits (for standard ASCII characters) determine the value of the extra bit. For instance, if the number of l's found in the original byte is odd (1, 3, 5 or 7), the parity bit will be set to 1. If an even number of 1's (0, 2, 4, or 6) appears in the original byte, the parity bit will be set to 0. As a result, there is always an even number of l's in the entire group of eight bits. In our case, the parity bit will be the right-most bit of every byte that is transmitted or stored. Assume, for example, that two devices are communicating with each other using even parity (the most common form of parity checking). As the transmitting device sends data, it counts the number of set bits (i.e. 1’s) in each group of seven bits. If the number of set bits is even, it sets the parity bit to 0; if the number of set bits is odd, it sets the parity bit to 1. In this way, every transmitted byte has an even number of set bits. On the receiving side, the device (in this case simulated by your program) checks each byte to make sure that it has an even number of set bits in each byte. If it finds an odd number of
Background image of page 1
set bits, it knows there was a corrupted character transmitted. The sender and receiver devices must both agree to use even parity checking. Although this technique detects many errors, it is not foolproof, because it cannot detect situations in which several bits in the same data unit or several data units are changed due to electrical noise or other interference. Checksum - In order to catch some of these other errors, we need additional information. A common technique performs a checksum of all the bytes in a larger grouping (in this case in a line of characters). When all of the bytes do not add up correctly, we know that some of the data units have been corrupted. The technique we will use adds an unsigned 16 bit value onto the end of the data grouping. In our case, the integer values of the ASCII characters in that line (including the parity bits and the ‘\n’) should add up to the value found in the checksum field that follows it. There are many other more sophisticated protocols for ensuring greater transmission accuracy which perhaps you will encounter in future courses. General Requirements You will write a parity and checksum detection program that takes a coded binary file as input, examines the bytes for validity ( even parity ), and also examines each line for validity ( checksum ). Your program should write the decoded text of the input binary file to the screen, so that it may be viewed, along with indicators of the corrupted data that was found. After all the data in the file has been processed, your program should report how many corrupted characters and lines were found in that file. Input Requirements You are given a binary file on the BB that you may assume has already been transmitted to your computer, and which was coded for error detection. It contains redundant information to be analyzed to help find what data may have been corrupted on transmission. It has even parity for each byte and also a 16 bit checksum value after each new line in the file. Read from "CodedText" as a binary file. Process Requirements You must check the parity of each byte, and then extract the character of text from the byte. Whenever a new line character is found, read in the next two bytes of data as an unsigned short int which contains the recorded checksum value for that line. Also you will need to find the sum of the ASCII values of all characters on that line (including the parity bits and the new line character). Thus you will have the checksum_from_file and the checksum_as_calculated . These will need to be compared to see if you have a corrupted line. You may assume that the new line characters have not been corrupted. Output Requirements For each input line along with the checksum value there are 3 possible output cases that you must handle: In all cases you will need to strip out the parity bits and the checksum value before you output that line to the screen.
Background image of page 2
Show entire document

Recently Asked Questions

Why Join Course Hero?

Course Hero has all the homework and study help you need to succeed! We’ve got course-specific notes, study guides, and practice tests along with expert tutors.

-

Educational Resources
  • -

    Study Documents

    Find the best study resources around, tagged to your specific courses. Share your own to gain free Course Hero access.

    Browse Documents
  • -

    Question & Answers

    Get one-on-one homework help from our expert tutors—available online 24/7. Ask your own questions or browse existing Q&A threads. Satisfaction guaranteed!

    Ask a Question