04-05-2016 07:56 AM
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
04-06-2016 02:11 AM
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