Visual basic and elm327

Everything regarding communication-protocols like CAN, OBD, LIN, JTAG, BDM, I2C, SPI, ...
Post Reply
oscarboiro
Active member
Posts: 123
Joined: 19 Feb 2019, 21:50

Visual basic and elm327

Post by oscarboiro »

last months im work to program my own diagnostic software.
Im using a visual basic net to made it, i have a kuga MK1 and to program and configure modules is different process of mondeo, but if any user want program her own software, i thing good option write here.

My tool is a "bad" version of elmconfig, my unique purpose is learning, in the internet exist a good tols (elmconfig, forscan, ucds....) but i think, to learning need made it.

I will be happy to share knowledge and experiences with everyone
Kuga MK1 owner
User avatar
Stevebe
Pro
Posts: 258
Joined: 08 Feb 2019, 12:28

Re: Visual basic and elm327

Post by Stevebe »

oscarboiro wrote: 02 Feb 2020, 22:27 last months im work to program my own diagnostic software.
Im using a visual basic net to made it, i have a kuga MK1 and to program and configure modules is different process of mondeo, but if any user want program her own software, i thing good option write here.

My tool is a "bad" version of elmconfig, my unique purpose is learning, in the internet exist a good tols (elmconfig, forscan, ucds....) but i think, to learning need made it.

I will be happy to share knowledge and experiences with everyone
As I said on messenger I would love to lern, I have Vs 17 running but I’m struggling
Digimod
oscarboiro
Active member
Posts: 123
Joined: 19 Feb 2019, 21:50

Re: Visual basic and elm327

Post by oscarboiro »

The fist step is made a serial reader/write to comunicate the aplication with ELM327

i made a very very basic tool to read/write serial port:

Code: Select all

Public Class Form1
    'This aplication is example of comunication ELM327 to Visual basic software
    'Programmed for https://microhacker.denkdose.de/ by Oscarboiro




    'Declarate variables
    Dim myPort As Array


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        Me.CenterToParent()

        BaudBox.SelectedItem = "38400"

        'Read COM ports in the system
        COMBox.Items.Clear()

        Dim i As Integer
        myPort = IO.Ports.SerialPort.GetPortNames()
        COMBox.Items.AddRange(myPort)
        i = COMBox.Items.Count
        i = i - 1
        Try
            COMBox.SelectedIndex = i
        Catch ex As Exception
            Dim result As DialogResult
            result = MessageBox.Show("com port not detected", "Warning !!!", MessageBoxButtons.OK)
            COMBox.Text = ""
            COMBox.Items.Clear()
            Call Form1_Load(Me, e)
        End Try

        COMBox.SelectedItem = "COM1"
    End Sub

    Private Sub ConnectButton_Click(sender As Object, e As EventArgs) Handles ConnectButton.Click

        Timer1.Enabled = True
        SerialPort1.BaudRate = BaudBox.SelectedItem
        SerialPort1.PortName = COMBox.SelectedItem
        SerialPort1.Open()
        Timer1.Start()

    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        'Read serial port constantly
        Try
            Dim i As String = SerialPort1.ReadExisting
            SerialVisor.Text &= i

        Catch ex As Exception

        End Try
    End Sub

    Private Sub WriteButton_Click(sender As Object, e As EventArgs) Handles WriteButton.Click
        'Send data to serial port
        SerialPort1.Write(TextBox1.Text & vbCr)
    End Sub
End Class
in new Window form need next components:

-Timer
-SerialPort
-2 combo box
-1 textbox configured in multiline
-1 textbox
-2 buttons
- and two labels

with this code, you need set the COM port and baud rate and push connect, after if the connectios is OK you write ATWS and the elm327 request firmware version, if the aplication work fine, next step is configure ELM327 with AT commands....

the source code here:
Serial Connection with ELM327.rar
You do not have the required permissions to view the files attached to this post.
Kuga MK1 owner
Post Reply