I am using a CompactDAQ to measure signals. Currently I am reading 10 signals: 2 channels of 2-lead resistance (thermistor) from NI9219, and 8 channels of thermocouple. I am running LabVIEW 8.6. I read one sample in all channels a time and then read another sample. I don't know why I can only get one sample of all channels every 3 seconds. The hardware specs are better than this. Please see attached program.
Solved! Go to Solution.
You did not include the 'EventTimer' subVI.
Not sure why you are referring to any hardware specs. Since you are using single point acquisition (software timed), none of the acquisition rates in the spec will apply.
There a number of things you can do to improve your performance.
First, you are using the NI 9219 in High Resolution timing mode. That puts your converstion time at 510ms for all channels. Was that intentional?
Second, you are reverifying and committing your task with every iteration of your for loop. Since there was no explicit state transition, the task will unwind after each read and have to setup the task again before each subsequent read. Put a Start vi just before your for loop. This will leave your task in the running state and greatly increase your performance.
Finally you are using on demand timing. Is this what you want? If you're trying to go as fast as possible on the NI 9219 you might want to consider using hardware timing. This way the device samples in the background and you can read data when it is available. Note that you need to pay attention to the max rate. If you use hardware timing and sample at a rate faster than your NI 9219 reports, it will return repeated data.
I was not aware that I put NI9219 in high resolution timing mode. The code was generated by the DAQ assistant. I will take a look at this.
Could you please give a example of the Start.vi?
I misunderstood the on demand timing with hardware timing, I will change that.
I guess I would be happy with sampling all channels every 1 second, so I am pretty sure that 9219 can handle this.
By Start I mean "DAQmx Start Task.vi". You can find it on the "DAQmx - Data Acquisition" pallette.
As for on demand versus hardware timing, that depends on how often you want to acquire data. Do you want to acquire as fast as possible? At set intervals? When a user requests it?
Depending on your accuracy requirements, you can go faster than 1Hz with the NI 9219. Take a look at the various timing modes listed in the NI 9219 specifcations.
I added the "DAQmx Start Task.vi" to the program and now my real program (more complicated than the test code) runs about 2 samples per second. So far, I am happy.