Can anyone help me with my project. I need to create a crc32 checksum in excel. My project is to detect an error if the data of ph value is being edit.
In excel there is to column which is ph value and checksum value that being transmit from arduino. So i expect that, if the ph value being edit, there is gonna have the new checksum column that can be compare with the exist checksum. Or it also can display "data manipulated" in another column. Please help me. Thank you.
'''
const uint32_t crc32_poly = 0xEDB88320;
uint32_t crc_table[256];
void precompute_crc_table() {
for (uint32_t i = 0; i < 256; i++) {
uint32_t crc = i;
for (int j = 8; j > 0; j--) {
crc = (crc & 1) ? (crc >> 1) ^ crc32_poly : (crc >> 1);}
crc_table[i] = crc; }
}
uint32_t calculate_crc32(const char* str) {
uint32_t crc = 0xFFFFFFFF;
for (int i = 0; str[i] != '\0'; i++) {
crc = (crc >> 8) ^ crc_table[(crc ^ str[i]) & 0xFF];
}
return crc ^ 0xFFFFFFFF;
}
''' Above are my codes that I use in my C coding for crc32 checksum of the ph sensor. Can you help me to create it in excel. Do I have to use VBA.
You can use the
MID(),CODE(),BITAND(),BITXOR(), andBITLSHIFT()orBITRSHIFT()(depending on the CRC) operations to implement a CRC calculation on a string of ASCII characters. If there are Unicode characters in the string, how to do it will depend on whether the CRC you are comparing to was calculated on a UTF-8 or UTF-16 representation of the string.For specifics, you would need to provide more information on the particular CRC-32 from the Arduino that you need to match. I count twelve different CRC-32 definitions in an online catalog of CRCs.