Imports DCON_PC_DOTNET
Public Class Form1

    Private Sub Open_Com_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Open_Com.Click
        DCON.UART.Open_Com(4, Convert.ToUInt32(115200), 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(4)
    End Sub

    Private Sub Read_DI_Counter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Read_DI_Counter.Click
        Dim iConvert_val As UInteger
        Dim iRet As Integer

        iRet = DCON.IO_Function.Read_DI_Counter(4, 5, -1, 0, 16, 0, 100, iConvert_val)

        If iRet <> 0 Then
            MessageBox.Show("Error Code  " + iRet.ToString)
        Else
            TxtCV.Text = iConvert_val.ToString
        End If


    End Sub

    Private Sub Clear_DI_Counter_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clear_DI_Counter.Click
        Dim iRet As Integer
        Dim iConvert_val As Integer

        iRet = DCON.IO_Function.Clear_DI_Counter(4, 5, -1, 0, 16, 0, 100)

        If iRet <> 0 Then
            MessageBox.Show("Error Code  " + iRet.ToString)
        Else
            DCON.IO_Function.Read_DI_Counter(4, 5, -1, 0, 16, 0, 100, iConvert_val)
            TxtCV.Text = iConvert_val.ToString
            MessageBox.Show("Clear success !!")
            
        End If
    End Sub
End Class
