Signal Conditioning

cancel
Showing results for 
Search instead for 
Did you mean: 

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

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
0 Kudos
Message 1 of 2
(3,440 Views)

Hi, 

did you try to run the DAQmx example in folder C:\Users\Public\Documents\National Instruments\NI-DAQ\Examples\DotNET3.5\Analog Out\Generate Voltage\GenMultVoltUpdates_IntClk\VB ?

Do you get the same behaviour?

Bye!

 

Licia

0 Kudos
Message 2 of 2
(3,428 Views)