Hello all,

I am a newbie and i am totally lost.Do help me.

I want to accurately find baud rate.

I have already programmed such that if i send character 'i' i get some value from my microcontroller.


But the problem is i dont know how to program this:


In 10 sec, how many times I can transmit 'i' and receive data.


I thought all i have to do is set a timer that counts till ten and in the meanwhile transmit 'i' but i found that the timer does not seem to work parallely at all.


here is the code which dint work.

Code:
Public Class Form1
    Dim i As Integer
    Dim count As Integer
    Dim txt As String


    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Timer1.Enabled = True

    End Sub

    Private Sub calculate_transmit()
        Do While i < 10
            SerialPort1.WriteLine("i")
            txt = SerialPort1.ReadChar
            count = count + 1
            Debug.Print(txt)
        Loop

        Debug.Print("total 'i' sent = ")
        Debug.Print(count)

    End Sub

    Private Sub Form1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Click

        calculate_transmit()

    End Sub


    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        
        i = i + 1

    End Sub

  
End Class