It is a C implementation of a CRC calculation written probably for some kind of microcontroller.
Even if you would know C and understand the algorithm it would not make much sense to convert that to VB6 (while possible). You probably want to calculate the CRC for a string or a sequence of binary data. You should be able to find examples in the net.
If you are going to write code for the same device as the C code, you have use the same start value (hex A5) and the same polynomial (hex B1). If not, these must be specified in the documentation for your serial device.
Then implement the CRC algorithm in VB using examples from the net.
Or do it yourself. It is quite simple:
- You are working with byte values (which may be also single characters)
- Create a variable to hold the CRC and initialse it with the start value
- Apply the CRC for each byte / character of the input within a loop handling the 8 bits:
- If the LSB (the lowest bit) of input byte and CRC are identical shift both right by one
- Otherwise shift also both right by one and XOR the CRC value with the polynomial
- The CRC variable contains now the calculated CRC