[MSOE Homepage]

Dr. Taylor's MSOE Homepage

Courses

Unix is a Four
Letter Word

Photo Album

Personal Homepage

CS-182 Main page

CS-182 -- Lab 5 - Hamming Coder

Winter Quarter 1998-1999



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

S-331, 277-7339
t a y l o r@m s o e.e d u (remove spaces)
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 (7,3,4) 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 lab5.txt.
  • Output to the screen which bits in the stream are in error (if the seventy-second bit in the file lab5.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

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.)
  • 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.

The lab report is due at 4:00pm, Monday, Jan. 25, 1999, though you are encouraged to submit it sooner if you can. If you have any questions, consult the instructor.


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