From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Reading one channel one sample

Hey Everyone,

 

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.


Thanks

manny

 

0 Kudos
Message 1 of 4
(2,551 Views)

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.

aputman
------------------
Heads up! NI has moved LabVIEW to a mandatory SaaS subscription policy, along with a big price increase. Make your voice heard.
0 Kudos
Message 2 of 4
(2,529 Views)

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.

0 Kudos
Message 3 of 4
(2,510 Views)

Hi Manny,

 

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. 

 

Good luck. 

---------------------
Patrick Allen: FunctionalityUnlimited.ca
0 Kudos
Message 4 of 4
(2,501 Views)