[MSOE Homepage]

Dr. Taylor's MSOE homepage

Unix is a Four
Letter Word

My Photo Album

My Personal Homepage

CS-182 Main page

CS-182 -- Lab 5: Hamming Coder

Winter Quarter 1999-2000



Electrical Engineering and Computer Science Department
Dr. Christopher C. Taylor

CC-27C, 277-7339

www.msoe.edu/~taylor/

Purpose

The purpose of this lab is to provide the student with an opportunity to implement the solution to a "real-world" problem. This lab features the use of conditional statements, file stream operations, the boolean class, and introduces (at long last) functions.

Assignment

Electronic communications is often hampered by external interference which may distort the data while in transit between the sender and receiver. For example, a noisy phone line may garble a message being sent between two modems. In this lab we will take a look at a technique that can identify and correct transmission errors. The Hamming code is a technique which requires extra data to be sent in order to identify and correct errors.

The method requires a packet size of seven bits, and we assume that there is as most one error in each packet. Three of these bits are data bits and the other four bits are "checker" bits. We label the data bits as p1, p2, and p3 and the "checker" bits as i1, i2, i3, and i4. The scheme is most easily described graphically. Consider the following figure:

For a correctly transmitted signal, each of the circles should contain an even number of ones (and an even number of zeroes).

Write a function called HammingCheck() that will:

  • Accept one packet of data (as seven parameters).
  • If the packet is error free, return -1.
  • If the packet contains an error, return the index of the bit that is in error (0, 1, 2, 3, 4, 5, or 6).

Write a program that will:

  • Read a transmission stream from the file hamming.txt.
  • Output to the screen which bits in the stream are in error (if the seventy-second bit in the file hamming.txt is in error, your program should output a 72).
  • Output to a file the corrected transmission stream.

Hopefully this is obvious, but your program should call HammingCheck() in order to determine if an error exists in each data packet.

Programming consideration: It is always good in program design to consider potential modifications that may be required a some later date. Be sure to keep this in mind when designing your program.

Lab report (due 11:00pm, the day prior to week 7 lab)

The lab report should be self-contained. That is, it should be possible for someone to understand what you did and why without seeing anything other than your report. Your report should include:

  • Purpose
  • Problem Statement
  • Procedure (include reasons for your design decisions, etc.)
  • Documented source code (be sure to make note of the additional requirements associated with functions)
  • Discussion (example input and output sequences, problems you encountered, etc.)
  • A summary of your activity log indicating how much time you spent on each phase of the assignment. Please report the time in the following categories:
    • Design
    • Coding
    • Debug (before you think it's working)
    • Test (after you think it's working)
    • Documentation
    • Other
  • Conclusions (what you learned, suggestions of how the lab could have been better, things you would have done differently, etc.)

As with any report you submit, correct spelling and grammar are required. In addition, your report should be submitted electronically following the Electronic submission guidelines. (You may wish to consult the sample report before submitting your report.) Be sure to keep copies of all your files, in case something gets lost. It may be wise to keep a diskette backup as well.

If you have any questions, consult the instructor.

Electronic Submission Formatting Note

To include the circles figure (shown above) in your report, just include the following in text where you would like the figure to appear:

    \begin{center}
    \includegraphics[width=.5\textwidth]{hamming}
    \end{center}

This page was created by Dr. Christopher C. Taylor, copyright 1999.