In addition, also add a 'step' to the 'for j...' loop. C Code: for ( crc = i << 8 , j = 0 ; j < 8 ; j += i ) <==== Incrementing by ***i*** VB Code: For j = 0 To 7 Step i -Frank -----Original Message----- From: pic microcontroller discussion list [mailto:PICLIST@MITVMA.MIT.EDU] On Behalf Of Sergio Masci Sent: Wednesday, January 14, 2004 6:40 AM To: PICLIST@MITVMA.MIT.EDU Subject: Re: [OT:] C to VB conversion > And my feeble VB attempt: > > Option Explicit > Dim C16(255) As Long > > Sub CRC_Init() > Dim i As Long, j As Long > Dim crc As Long > For i = 0 To 255 > crc = i * 256 > For j = 0 To 7 > If crc >= &H8000 Then > crc = (crc * 2) Xor &H1021 > Else > crc = (crc * 2) Xor 0 > End If crc = crc AND &hffff > Next j > C16(i) = crc > Next i > End Sub I think the above is correct, try it and see. Regards Sergio Masci -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details. -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.