Imports DCON_PC_DOTNET
Public Class Form1

    Private Sub Read_Counter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Read_Counter.Click
        Dim CT_Value As UInteger
        Dim OF_Value As Short
        Dim iRet As Integer

        iRet = DCON.IO_Function.Read_Counter(7, 5, -1, Convert.ToInt16(TxtCN.Text), 0, 100, CT_Value)

        If iRet <> 0 Then
            MessageBox.Show("Read Error")
        Else
            TxtCV.Text = CT_Value.ToString
            iRet = DCON.IO_Function.Read_Counter_Overflow(7, 5, -1, Convert.ToInt16(TxtCN.Text), 0, 100, OF_Value)
            If iRet <> 0 Then
                MessageBox.Show("Overflow error")
            Else
                TxtOV.Text = OF_Value.ToString
            End If
        End If


    End Sub

    Private Sub Clear_Counter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clear_Counter.Click
        Dim iRet As Integer

        iRet = DCON.IO_Function.Clear_Counter(7, 5, -1, Convert.ToInt16(TxtCN.Text), 0, 100)

        If iRet <> 0 Then
            MessageBox.Show("Error")
        Else
            MessageBox.Show("Success")
        End If
    End Sub

    Private Sub Open_Com_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Open_Com.Click
        DCON.UART.Open_Com(7, Convert.ToUInt32(9600), 8, 0, 1)
    End Sub

    Private Sub Close_Com_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Close_Com.Click
        DCON.UART.Close_Com(7)
    End Sub
End Class
