Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

Read All Channels from 6008 continously and display on screen

I have just started using the 6008 with VB6 and managed to use the loadtask command to load pre-defined tasks and then display the data results on the screen.
 
1. I have used loadtask because when I tried to use createtask I could not create one with a FSE rather than differential input. Even though the help screen shows the variable DAQmx_Val_FSE is used as a parameter in DAQmxCreateVoltageChan the variable does no appear in the VB object browser so does not compile.
 
2. I would like to read all the channels into an array continuously to a VB form.
 
I tried the following but after about 2 minutes the system hangs...
 
Do While True
    DAQmxErrChk DAQmxLoadTask("channel1", taskHandle)
    DAQmxErrChk DAQmxReadAnalogF64(taskHandle, 1, 10#, _
                    fillMode, data(0), 1, sampsPerChanRead, ByVal 0&)
    DAQmxStopTask taskHandle
    DAQmxClearTask taskHandle
    Text1.Text = data(0)
   
    DAQmxErrChk DAQmxLoadTask("channel2", taskHandle)
    DAQmxErrChk DAQmxReadAnalogF64(taskHandle, 1, 10#, _
                    fillMode, data(0), 1, sampsPerChanRead, ByVal 0&)
    DAQmxStopTask taskHandle
    DAQmxClearTask taskHandle
    Text2.Text = data(0)
   
    DAQmxErrChk DAQmxLoadTask("channel3", taskHandle)
    DAQmxErrChk DAQmxReadAnalogF64(taskHandle, 1, 10#, _
                    fillMode, data(0), 1, sampsPerChanRead, ByVal 0&)
    DAQmxStopTask taskHandle
    DAQmxClearTask taskHandle
    Text3.Text = data(0)
   
   
    DAQmxErrChk DAQmxLoadTask("channel4", taskHandle)
    DAQmxErrChk DAQmxReadAnalogF64(taskHandle, 1, 10#, _
                    fillMode, data(0), 1, sampsPerChanRead, ByVal 0&)
    DAQmxStopTask taskHandle
    DAQmxClearTask taskHandle
    Text4.Text = data(0)
   
    DAQmxErrChk DAQmxLoadTask("channel5", taskHandle)
    DAQmxErrChk DAQmxReadAnalogF64(taskHandle, 1, 10#, _
                    fillMode, data(0), 1, sampsPerChanRead, ByVal 0&)
    DAQmxStopTask taskHandle
    DAQmxClearTask taskHandle
    Text5.Text = data(0)
    DAQmxErrChk DAQmxLoadTask("channel6", taskHandle)
    DAQmxErrChk DAQmxReadAnalogF64(taskHandle, 1, 10#, _
                    fillMode, data(0), 1, sampsPerChanRead, ByVal 0&)
    DAQmxStopTask taskHandle
    DAQmxClearTask taskHandle
    Text6.Text = data(0)
   
    DAQmxErrChk DAQmxLoadTask("channel7", taskHandle)
    DAQmxErrChk DAQmxReadAnalogF64(taskHandle, 1, 10#, _
                    fillMode, data(0), 1, sampsPerChanRead, ByVal 0&)
    DAQmxStopTask taskHandle
    DAQmxClearTask taskHandle
    Text7.Text = data(0)
   
    DAQmxErrChk DAQmxLoadTask("channel8", taskHandle)
    DAQmxErrChk DAQmxReadAnalogF64(taskHandle, 1, 10#, _
                    fillMode, data(0), 1, sampsPerChanRead, ByVal 0&)
    DAQmxStopTask taskHandle
    DAQmxClearTask taskHandle
    Text8.Text = data(0)

    Me.Refresh
Loop
 
Any help would be appreciated...
 
Peter
0 Kudos
Message 1 of 2
(6,431 Views)
Although I have no experience using DAQmx with VB, the first thing I notice is that you are using (or trying to use) a separate task for each channel. Try setting up one Task that includes all of the channels that you wish to acquire. Have you looked at any examples? The following may be a good starting point:

http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=04C0E4E900FB6E73E0440003BA7CCD71&p_node=201213&p_source=External

Hope this sheds some light on the subject!

Good luck,

Stuart
0 Kudos
Message 2 of 2
(6,424 Views)