- Код: Выделить всё
Public Function CRC16(DataArray() As Byte, Optional wInitCRC As Long = 0) As Long
Dim crc As Integer, j As Byte, size As Integer, i As Long
crc = wInitCRC
For i = 0 To DataArray(1) - 3
crc = crc Xor PDL((DataArray(i)), 8)
For j = 0 To 7
If crc And &H8000 Then
crc = PDL(crc, 1) Xor &H1021
Else
crc = PDL(crc, 1)
End If
Next j
Next i
CRC16 = crc
End Function
в строчке
- Код: Выделить всё
For i = 0 To DataArray(1) - 3
DataArray = "[string]"
PDL это функция сдвига (если надо могу тоже прислать)