Although I haven't finished the whole lab yet, I'm going to write something I've done till this moment.
-------------------- Part of The Requirements of This Lab------------------------
1. Load a 16-bit register with FFFF hex (all ‘1’s). Call this the CRC register.
2. Exclusive OR the first 8-bit byte of the message with the low-order byte of the 16-bit CRC register, putting the result in the CRC register.
3. Shift the CRC register one bit to the right (toward the LSb), zero-filling the MSb. Extract and examine the LSb.
4. If the LSb is ‘0’, repeat Step 3 (another shift). Otherwise, if the LSB is ‘1’, Exclusive OR the CRC register with the polynomial value 0xA001 (1010 0000 0000 0001).
5. Repeat steps 3 and 4 until eight shifts have been performed. When this is done, a complete 8-bit byte will have been processed.
6. Repeat steps 2 through 5 for the next 8-bit byte of the message. Continue doing this until all bytes have been processed.
7. The final content of the CRC register is the CRC value.
8. When the CRC is placed into the message, its upper and lower bytes must be Swapped to let the High 8-bit first and followed by low 8-bit.
----------------------Part of My Codes----------------------
//read message from test.txt file
//read a byte of file once to message
//use an array of byte CRCRegister to store 0xFFFF
//shift 8 times once read a byte. EX or with 0xA001 if lsb is 1 while shifting
//one byte has 8 bits, however, if the MSB of the byte is 0, it won't be shown. So I use switch statements to show these 0s.
//combine 2 bytes of the CRCRegister together, and output the result
-----------------------END & TO BE CONTINUED-------------------------