Hello guys :)

I have a prog. assignment due on Sunday! I need help to get me started. The task is implement a program for any hamming codes not just (7,4). The user input the following:
1. Desired hamming code (n,k)
2. Choose to encode or decode.

So, I am thinking there will be a main function, encode function, decode function. and menu function. It will be neat to track errors using function rather than just writing everything in the main function, right!

Anyhow, I am somewhat confused and not understanding the basic concept of hamming codes. I could picture the source code layout but still can not start it. Can anyone help me to at least start????

Thanx
Mel

SpS commented: Throw Away Your Bad Habits +0

Fist best place to start is knowing what a hamming distance is, and how to get the MHD ... I assume for your menu you'll have a while loop ...

//whilst int x = 1
{
//do this
}

//whilst int x = 2
{
// do this
}

that could be your menu system. But for deffo you need the minuimn hamming distances for each code my friend.

Ok. hammering code, is a way of encoding a string of data, to ensure that the data will get from point a to point b saftely. It's an error prevention code, so that interfernce such as single bit errors cuased to a signal distrutption.

Hammering code works as follows.

Original code (in binary)

1 0 1 0 1 1 1 0 1 1 0

For Hammering code, you work with powers of 2
so 2 to the 0 is is 1
2 the 1st is 1
2 to the 2nd is 4
and so on, as long as your string allows.

There are check bits, which is how the hammering code allows for the check of errors

So....you have the following code

1 0 1 0 1 1 1 R8 0 1 1 R4 0 R2 R1

R1 check the parity (even parity) of everyother bit. So in other works, it check the parity of bits 1, 3, 5, 7, 9, 11, 13, 15, ect....

R2 check 2,3 skips 2 bits, checks 6,7 skips 2 and checks 10, 11 ect.

R4 checks 4,5,6,7, skips 4, checks 12,13,14,15 skip 4 ect

R8 checks bits 8,9,10,11,12,13,14,15, skips 8 and check the next 8 bits

For each power of 2 that you can have in the sting, that value is a check bit
which checks the 2 to the x value of bits, skips that amount, and checks the next amout in line.

Remember the the check bit, CHECKS IT'S SELF as well
ok so with out orignal code...

R1 check
1 0 1 0 1 1 1 R8 0 1 1 R4 0 R2 R1
1 0 1 0 1 1 1 R8 0 1 1 R4 0 R2 1 // R1 becomes a 1 becasue when checking the parity of the bits it checks, it finds there are 5 1's, to make it even, it becomes a 1 to make 6

R2 check
1 0 1 0 1 1 1 R8 0 1 1 R4 0 R2 1 // R2 found 5 1's and became a 1 to make even
1 0 1 0 1 1 1 R8 1 1 1 R4 0 1 1

R4 check
1 0 1 0 1 1 1 R8 1 1 1 R4 0 1 1
1 0 1 0 1 1 1 R8 1 1 1 1 0 1 1 // R4 changes

R8 check
1 0 1 0 1 1 1 R8 1 1 1 1 0 1 1
1 0 1 0 1 1 1 1 1 1 1 1 0 1 1 // R8 changes

Now not every time are they going to change, but every time it looks to see the number of 1's in it's check pattern, and if working with even parity is going to changes according to the parity of it's check bits.

Hammering Code is efficent for detecting, and correcting errors after transmission.

If you have more questions I'll try to help out.

Fist best place to start is knowing what a hamming distance is, and how to get the MHD ... I assume for your menu you'll have a while loop ...

//whilst int x = 1
{
//do this
}

//whilst int x = 2
{
// do this
}

that could be your menu system. But for deffo you need the minuimn hamming distances for each code my friend.

the Distance to apply the hamming code...is this between check/redundacy bits? Or is this the amount of bits to check?

I just have theory from a class I'm in now...and would actually like to see how this is implemented.

hi there...
i'd b very glad if u can plz send me the full code for (n,k)hamming code as i have been searching in the net but to no avail...i have to complete by next week...

if by any chance u got the (n,k) hamming code..kindly mail them to me at shisen2@rediff.com,urgently needed as submissions by next week...

commented: Throw away your bad habits +0

> urgently needed as submissions by next week...
What makes you special?
http://www.daniweb.com/techtalkforums/announcement8-2.html

Noting also that this was 9 months old before you said "me too".

Agreed on both counts.

Due to the fact that the member who originally started this thread has not responded in quite a long time, this thread is considered abandoned and has been closed.

In accordance with our posting rules, other members having similar problems should start their own threads and post their questions there. In order to help us help you most quickly, please include as much information about your problem as possible in your posts.

If the member who originally started this thread wishes to have the thread reopened, please send your request, including a link to this thread, to one of our moderators via email or Private Message.

Thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.