Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Please convert from VB.net to VB6

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!

0 Kudos
Message 1 of 2
(4,745 Views)

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

0 Kudos
Message 2 of 2
(4,696 Views)