Vonny232
June 16th, 2006, 01:50 PM
Hi, i have got a tricky problem that I will try to explain.
I am supporting an application that recieves a data packet (with crc) from a modem, the program should store the supplied crc result and compare it with its own generated crc result!
the application generated CRC is generated as an integer that when converted to HEX represents 2 bytes.
eg 64409 converts to FB99 hex!
this is all fine! the crc function is a polynomial ccitt crc i got off the web!
anyways..
I want to compare this application generated CRC with the CRC attached to the end of the data packet being sent to me from the modem.
the problem is the CRC is contained in a byte array (0-1).
I cannot fathom how to turn a 2 byte array to an int value that can be compared!
Adding the values dont work, and concatinating the bytes as string then converting to int doesent work!
I think using the bit shift operator may work but I havent had any success yet, can anyone help!
recap :
byte array[0] = FB
array[1] = 99
I want to be able to convert both bytes to a single int so the result is a combined 64409 integer
Dan
I am supporting an application that recieves a data packet (with crc) from a modem, the program should store the supplied crc result and compare it with its own generated crc result!
the application generated CRC is generated as an integer that when converted to HEX represents 2 bytes.
eg 64409 converts to FB99 hex!
this is all fine! the crc function is a polynomial ccitt crc i got off the web!
anyways..
I want to compare this application generated CRC with the CRC attached to the end of the data packet being sent to me from the modem.
the problem is the CRC is contained in a byte array (0-1).
I cannot fathom how to turn a 2 byte array to an int value that can be compared!
Adding the values dont work, and concatinating the bytes as string then converting to int doesent work!
I think using the bit shift operator may work but I havent had any success yet, can anyone help!
recap :
byte array[0] = FB
array[1] = 99
I want to be able to convert both bytes to a single int so the result is a combined 64409 integer
Dan