I am acquiring temperature from three RTDs and I want to display the real-time temperature on the front panel. If i use the DAQ Express I have no problem doing so. However, I am trying to avoid using the DAQ Express and use DAQmx instead. On my front panel I have a numeric indicator for each RTD, but when I use the DAQmx to read in the 3 RTDs, the data flickers between 0 and the correct temperature measurent. I've adjusted the sampling frequency and the number of samples to see if that affected it, which it didn't. How can I display the real time data without it flickering between 0 and the correct measurment?
You have not used any loop timing inside your while loop. The loop will try and execute as fast as possible. The 9217 has a max sampling rate of 400S/sec
So if are reading very fast, the 9217 will not have any new samples which is why you are probably seeing the flickering. Include a wait until next multiple ms in your while loop
with a delay of about 100ms
I agree with voodoo_ that the issue is that you are calling DAQmx Read when there are no samples available. In this case, DAQmx Read will return a null array (since you have not specified the number of samples to read). Since it looks like you are only interested in a software timed update, I would recommend modifying your code to the following:
While inserting a wait into the while loop would likely also remedy the problem, I don't see the need for a continuous acquisition in this example. If you do need continuous acquisition, you can connect the Number of Samples to Read Per Channel input of DAQmx Read which will delay the loop according to how many samples you want to acquire per iteration.