I am hoping someone could help me out here. I have a simple application that requires to read one analog sample from one channel on each encoder pulse. i am using a third party DAQ card (DT9804 from Data translation).
I have attached a screenshot of my VI. Sorry, the VI is little messy.
I use encoder as an external clock and then read analog sample based on that. Since I want to read only one sample on each pulse, I connected "1" to samples per channel on the timing VI. I am writing the data into waveform chart. But the problem I am having is that it updates too slow. It starts updating right away, but finishes the graph updated few seconds after I have stopped turning the encoder.
Is there anything I am doing wrong. Let me know if there are any questions.
Any help would be appreciated.
This is all a guess because I'm not familiar with these drivers. But I think you want to read as many samples as are available in the buffer, assuming these DATX drivers work similar to DAQmx (I'm assuming they do since they are so similar, even the name). Your encoder drives the acquisition rate and when you only read one sample at a time, it may not be fast enough to keep up with the encoder.
I haven't used these drivers, but if you assume they work similar to the DAQmx drivers, you should probably read the data in bursts. Reading one at a time is much slower. Also, with DAQmx, Continuous Samples mode ignores the Samples per Channel input, so that might not be doing anything.
Try changing from "Read 1 sample every function call" to doing a "Get number of samples in buffer, then read that many samples" timed at some loop rate. If you're just doing it visually, I'd update no faster than 10 Hz.
Note that this chart will NOT have an even time distribution, so your data will NOT show up with respect to time- it'll give a data point at each encoder transition, which could happen within milliseconds of each other or within seconds of each other.
Have a look at the DATX Analog Triggered Scan Example.
I don't have any hardware to test with, but you might be able to tweak the example to give you what you need with the encoder.