10-24-2016 07:19 AM
Hello,
we got a bit of code to read out data coming to a NI pci dio 32hs device. It is written in vb.net, but our measurement software runs in vb6. Is it possible to convert this code to vb6?
newTask = New Task() 'Create a task that uses all digital ports as a single channel. newTask.DIChannels.CreateChannel("Dev1/Port0_32", "", ChannelLineGrouping.OneChannelForAllLines) newTask.Timing.ConfigureHandshakingBurstExportClock("/Dev1/PFI4", 10000000, DigitalLevelPauseTriggerCondition.High, ReadyForTransferEventLevelActiveLevel.ActiveHigh, SampleClockPulsePolarity.ActiveHigh, SampleQuantityMode.FiniteSamples, 128 * numScans.Value) reader = New DigitalSingleChannelReader(newTask.Stream) 'Wait until all desired samples are read. newData = reader.ReadMultiSamplePortUInt32(-1)
Thanks in advance!
10-25-2016 08:04 AM
I spent some time on it and this is what I came up with:
' Create the DAQmx task. DAQmxErrChk DAQmxCreateTask(" ", taskHandle) ' Add a digital input channel to the task. DAQmxErrChk DAQmxCreateDIChan(taskHandle, "Dev1/Port0_32", "", _ DAQmx_Val_ChanForAllLines) ' Start the task running, and read from the digital lines. DAQmxErrChk DAQmxCfgBurstHandshakingTimingExportClock(taskHandle, DAQmx_Val_AcquisitionType_FiniteSamps, _ 144, 10000000, "/Dev1/PFI4", DAQmx_Val_Polarity2_ActiveHigh, DAQmx_Val_Level1_High, DAQmx_Val_Polarity2_ActiveHigh) DAQmxErrChk DAQmxStartTask(taskHandle) DAQmxErrChk DAQmxReadDigitalLines(taskHandle, 1, 10#, DAQmx_Val_GroupByChannel, readArray(0), arraySizeInBytes, _ sampsPerChanRead, numBytesPerSamp, ByVal 0&) DAQmxErrChk DAQmxStopTask(taskHandle) DAQmxErrChk DAQmxClearTask(taskHandle)
Doing this I get no error message, but also just an empy readArray (defined as byte array).
Is ReadDigitalLines the right command to read out Port0_32 ?
Best,
Julian