Measurement Studio for VB6

cancel
Showing results for 
Search instead for 
Did you mean: 

the vb NiDaqMx tutorial,how does the program get its input from the DAQ?

Hi Tom,
 
Turns out I had to reset the device. Apparently every time the code crashes I need to reset it. Thnaks so much for helping. My new project is going to be based on this example and I'll add to it. Should  I post any further issues related to this in this thread, or start another?
saroj
 
0 Kudos
Message 21 of 50
(5,184 Views)

Hi saroj-

If you need more help getting started feel free to post here.  If you have specific questions about your app that might benefit from a larger audience I would suggest posting a new thread as it can be a bit hard to wade through a long one like this.  Best of luck with your app-Smiley Happy

Tom W
National Instruments
0 Kudos
Message 22 of 50
(5,181 Views)

Good Morning Tom,

In the example AcqIntClk, the min and max for all the channels is the same . -10 to 10 volts. In my case the min,max will vary for each of 8 or so channels. Does this mean I need to have 8 separate sets of API calls for 8 channels instead of the contiguous ai0:8 as the example uses? i.e 8 createTasks, 8 configureTasks, 8 createChannels etc?

Thanks,

saroj

0 Kudos
Message 23 of 50
(5,171 Views)

Hi saroj-

You're almost correct- you can only have a single task running at any one time on the board, so you should just create and configure one task and then call the createChannel function 8 times and refer back to the single task you have created.  This will allow you to set different gain (i.e. min/max values) for each of the channels you will be scanning.

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 24 of 50
(5,168 Views)
ok thanks. I had made multiple tasks and it was very unhappy.
 
Now the question is, if I do 8 analog64 reads, will it know to read the channels consecutively? So the first read will fill up data0 with signal 1, the second read will fill up data1 with signal 2 etc?
 I cant test it out since I have a simulated device and the signals are identical, so I wont be able to tell if its reading only 1 signal over and over or the consecutive signals.
thanks,
saroj
0 Kudos
Message 25 of 50
(5,166 Views)
Hi saroj-
 
Each time you call a DAQmx read function it returns the number of samples requested for all channels.  This means that if you have 8 channels in your task and use a numSampsPerChan of 10 then an 80 element array will be returned.  There is no way to read from a single channel in the data stream at a time.  The fillMode parameter dictates how the various channel data will be arranged in the array.  More information can be found in the NI-DAQmx C Reference help for the read function you are using.
 
Hopefully this helps-
Tom W
National Instruments
0 Kudos
Message 26 of 50
(5,159 Views)

Hi Tom,

When the config is set up to read 750 samples at 250 samples per second continuously , so that the sample collection wil take 3 seconds, and I have my read in a loop like this:

 

while isRunning

 DAQmxErrChk DAQmxReadAnalogF64(taskHandle, numSampsPerChannel, 10#, _
                    fillMode, data(0), arraySizeInSamps, sampsPerChanRead, ByVal 0&)

CWGraph1.PlotY data
 Loop

then how fast will it read the board? Will the read wait for 750 samples to be collected before it executes?

Will I see the plot update once every three seconds? I dont have the board here so I cant test it out.

Please let me know.

thanks,

saroj

0 Kudos
Message 27 of 50
(5,137 Views)
Answering my own question. I tried it using the Timer() with the simulated device and indeed it waits 3 secs to do the read. Interesting. If there's more I need to know about this timing issue, please let me know,
thanks,
saroj
0 Kudos
Message 28 of 50
(5,134 Views)

Hi saroj-

The DAQmx Read functions are indeed blocking calls that will wait until the requested number of samples are available.  The timeout parameter specifies how long to wait before the DAQmx Read operation will abort and an error will be thrown.

One caveat of using simulated devices is that timing and triggering information is not always realistic.  Finite acquisitions and all triggering operations complete immediately without giving realistic wait times when simulated devices.  Continuous acquisitions give realistic wait times only in NI-DAQmx 8.0 and later.  Previous versions saw continuous acquisitions with simulated devices also completing immediately.  With physical devices, both finite, continuous, and triggering operations operate as expected as I described in my first paragraph.

Thanks-

Tom W
National Instruments
0 Kudos
Message 29 of 50
(5,132 Views)
Hi Tom,
My board will be measuring volume, pressure and temperature. I had assumed that I would create one aiVoltageChannels for these three types of inputs coming in on the pins of the daq board and do Dev1/ai0:8
 
But I see theres a DAQmxCreateAIRTDChan. I'm confused now. Do I have to treat the temperature channels (5,6,7) differently and make this rtd channel for therm?
Please clarify.
thanks,
saroj
0 Kudos
Message 30 of 50
(5,104 Views)