Quantcast
Channel: Measurement Studio for VB6 topics
Viewing all articles
Browse latest Browse all 323

data acquisition Ni - 6341USB, using drivers NIDAQmx on VB.net

$
0
0

Hi there, i have a problem using MyTask.Timing function.

 

I would like to know how I can controll the samplerate frequency; while using MyTask i noticed that it doesn't make the expected cycles but only the first.

I can only control the data sampling rate on Matlab with the .Rate option, but  i couldn't control it directly using VB.net

 

Thank You.

 

Private Sub btSTART_Click(sender As Object, e As EventArgs) Handles btSTART.Click
        '#####################################################################################


        NC = NumericUpDown1.Value 'numero di cicli

        Dim cycleIndex As Integer = 0
       


        If isJustHomed = True Then
           

xHome = Math.Round(AxMintController1.get_Pos(0) * CConv, 4)
       

End If


   Dim Vel(Ns - 1) As Double


        AxMintController1.set_Suspend(0, 0) 'Remove "hold"  to the engine
       

HoldBox.Checked = False

        Dim myTask As New Task                                 ' Assign a name to "task"
       

myTask.AOChannels.CreateVoltageChannel(ComboBoxMo.Text, "MOTOR", Convert.ToDouble(tbminMo.Text), Convert.ToDouble(tbmaxMo.Text), AOVoltageUnits.Volts)
       

myTask.Timing.ConfigureSampleClock("", TextBox7.Text, SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples)

        Dim writer As AnalogSingleChannelWriter = New AnalogSingleChannelWriter(myTask.Stream)
      

  Do
            For I As Integer = 0 To Ns - 1        

            Vel(I) = v(I) * kV
    

        Next
            'writer.WriteMultiSample(True, Vel) 'synchronous
           

writer.BeginWriteMultiSample(True, Vel, Nothing, Nothing) 'Asynchronous
           

myTask.WaitUntilDone()
           

xStop = Math.Round(AxMintController1.get_Pos(0) * CConv, 4)
       
            NC -= 1
            '
            Label3.Text = NC
          
            TextBox11.Text = xStop - xHome
           
        Loop While NC <> 0

Viewing all articles
Browse latest Browse all 323

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>