Code snips, and programming examples.

Find the CRC of OBDII Packet VB6

Function FindCRC(Value)
   Dim val(5) As Byte
   value1 = Left(Value, 2)
   value2 = Mid(Value, 4, 2)
   value3 = Mid(Value, 7, 2)
   value4 = Mid(Value, 10, 2)
   value5 = Right(Value, 2)
   val(1) = "&H" & value1
   val(2) = "&H" & value2
   val(3) = "&H" & value3
   val(4) = "&H" & value4
   val(5) = "&H" & value5
   FindCRC = Hex(CalcCRC(val))
End Function

Function for VB6, (place it in a module) to find the CRC of incoming data on the BR-3 OBDII module.

By |June 19th, 2010|Categories: Code|Tags: , , , |0 Comments

Calculate the OBD CRC Packet VB6

Function CalcCRC(s() As Byte) As Byte
   checksum = 0
   crcreg = 255
   length = UBound(s) - LBound(s)
   For i = 1 To length
       bitpoint = 128
       x = s(i)
       For k = 0 To 7
           If bitpoint And x Then
               If crcreg And 128 Then
                   poly = 1
                   poly = 28
               End If
               crcreg = (((crcreg * 2) Or 1) Xor poly) And 255
               If crcreg And 128 Then
                   poly = 29
                   poly = 0
               End If
               crcreg = ((crcreg * 2) Xor poly) And 255
           End If
           bitpoint = bitpoint \ 2
       Next k
   CalcCRC = (Not crcreg) And 255
End Function

VB6 function, (place it in a module) that will calculate the crc hex packet to use with the BR-3 OBDII unit.

By |June 19th, 2010|Categories: Code|Tags: , , , |0 Comments

Android Notifier

Simple Windows program I created really quick in VB6 that will accept simple messages from the Android running the ‘android-notifier‘ application.

Since the author has not written a Windows application yet, I made this small ghetto client to hold off some at the office, and use the code in the CarputerGTP project.

Android-Notifier Popup ExampleAttached is the program itself, the source code for any interested, and the Microsoft Winsock component. You must place the MSWINSCK.OCX file in your C:\Windows\System32 folder.

Android-Notifier (Program Only) | Android-Notifier (Source Code) | MSWINSCK.ZIP (Winsock Component)

On the android, connect to the wireless network, and choose a custom IP. Key in the IP of the machine running this program. Done.

At the moment I only have it displaying tooltip popups for PING (Testing connection packets), SMS (Test Messages), and RING (Incoming calls).

By |June 9th, 2010|Categories: Code|Tags: , , , |0 Comments