This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Hamming Code

Hello,

I'm having an issue starting a hamming code. I understand fundamentally how they work, in for example, an 8 bit system. 4 redundant bits will be added which are used as parity bits. I know their positions (powers of 2), but how exactly does one do this in code?
If I have 1111 and do

MOV r0, #0xF
LSR r0, r0, #2


I will get 0011 1100. This gives me my first two parity bits. But how do I get the next one? I don't know how to shift everything after bit 2 to the left without moving my data bit at bit 2. I think I need to use multiple registers for each insertion of redundant bit and possibly using something like an EOR operation to join them together.

Thank you very much

Parents
  • Pretty sure the right shift with get you 00000011 (0x03)

    You'll need to use multiple registers and BIC or AND instructions to mask the bits, and the OR or EOR instructions to merge or invert bits back in.

    Suggest you implement and test algorithm in C, where you can print out and display what is happening. Once you have that nailed down write it in assembler.

Reply
  • Pretty sure the right shift with get you 00000011 (0x03)

    You'll need to use multiple registers and BIC or AND instructions to mask the bits, and the OR or EOR instructions to merge or invert bits back in.

    Suggest you implement and test algorithm in C, where you can print out and display what is happening. Once you have that nailed down write it in assembler.

Children