Finished CRC calculation function in C and integrated with PMControl