Jump to content
  • 0

USB-TC Analog Data Acquisition


TFisherIRA

Question

I found the following code on a Youtube video from 11 years ago for reading a MCC DAQ analog output

Public Class Form1
    Dim mydaqboard As New MccDaq.MccBoard(0)
    Dim dataval As System.Int16
    Dim engunit As Single
    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Timer1.Start()
    End Sub

    Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick
        mydaqboard.AIn(0, MccDaq.Range.Bip10Volts, dataval)
        mydaqboard.ToEngUnits(MccDaq.Range.Bip10Volts, dataval, engunit)
        Label2.Text = engunit
    End Sub
End Class

The program executes without errors, however it only displays an output of -10 in Label2. Everything works as intended in DAQami so hardware is not the issue. How can get this program to readout properly in Visual Basic?

Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0

I've tried writing another program for reading thermocouples based on insipiration from DaqInScan03 and still no success

 

Public Class Form1
    Dim ULStat As MccDaq.ErrorInfo
    Dim DaqBoard As New MccDaq.MccBoard(0)
    Dim Temperature As Single ' Variable to store temperature value

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        ULStat = DaqBoard.GetTCValues({0}, Nothing, 1, IntPtr.Zero, 0, 1, MccDaq.TempScale.Celsius, Temperature)

        If ULStat.Value = MccDaq.ErrorInfo.ErrorCode.NoErrors Then
            Label1.Text = Temperature.ToString("0.000\°\C")
        Else
            Stop ' Handle error
        End If
    End Sub
End Class

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...