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.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Create a pattern to reduce the number of times the NI USB-6353 is accessed.

Hi, I have a simple code to find UVLO/OVP for my purposes using  NI 6353 card, it work fast, but can i do it faster?
I calculated and determined that every time I access the card it takes 2-5ms and with a large number of passes it can take 50-100ms. Can I reduce the number of card calls by creating a pattern?
As I imagine it:
1. The first request, I tell the card what array of voltage to constantly display (AO).
2. Second request, I say that for each AO voltage, you need to measure the output(AI) with a certain number of samples.
3. And at the end, I get a 2D array of data, which I can analyze later.

0 Kudos
Message 1 of 7
(933 Views)

If you want your DAQmx code to perform faster, don't use DAQ Assistant. Use the DAQmx API. See Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications and the shipping examples at Help >> Find Examples >> Hardware Input and Output >> DAQmx

Message 2 of 7
(925 Views)

Hi, thanks,

Using the DAQmx API made my program even faster, but I was still wondering if it is possible to reduce the number of 6353 calls, that is, create a task once and write it to 6353 memory and then read this two-dimensional array once.
I did not notice a direct answer to my question in the examples.

See Learn 10 Functions in NI-DAQmx and Handle 80 Percent of Your Data Acquisition Applications and the shipping examples at Help >> Find Examples >> Hardware Input and Output >> DAQmx

Because as you can see, every time I tell 6353 what voltage to set (AO) and how to read it later (AI). It is precisely this repetition that I want to avoid.
 So is it possible to create such a pattern or not?

0 Kudos
Message 3 of 7
(709 Views)

Instead of writing one sample and reading 20 samples repeatedly 400 times, why don't you write 400 samples and read 8000 samples at once? This would greatly reduce the number of API calls. You can refer to Synchronized Analog Output Loopback to Analog Input Using LabVIEW with DAQmx to synchronize the tasks.

Message 4 of 7
(703 Views)

But how can I control(know) that for one sample out of 400 samples(AO), I will get 20 samples(AI) out of 8000 samples?
Is it the magic of clocks and triggers together with synchronization?

0 Kudos
Message 5 of 7
(695 Views)

You can configure both AI and AO tasks to generate their own sample clock at different rates. Refer to Synch AI-AO to an External Sample Clock Generate by Onboard Counter Using LabVIEW with DAQmx.You can remove the CO task and leave the clock source for DAQmx Timing (Sample Clock) VI unwired to use the default onboard clock. For the sample rate input for DAQmx Timing (Sample Clock) VI, specify N for AO and 20N for AI. Since the tasks are synchronized, you will always get 20 AI samples for every AO data. 

0 Kudos
Message 6 of 7
(689 Views)

@ZYOng wrote:

Instead of writing one sample and reading 20 samples repeatedly 400 times, why don't you write 400 samples and read 8000 samples at once? This would greatly reduce the number of API calls. You can refer to Synchronized Analog Output Loopback to Analog Input Using LabVIEW with DAQmx to synchronize the tasks.


Great help from ZYOng!   But one little tidbit for the OP:  the linked example is subtly flawed for sync -- there really shouldn't be a Start Trigger for AI.  Its presence is liable to cause a timing offset between the AO and AI tasks.  Sync would be more certain if you remove the Start Trigger.

 

But for your specific situation, you want different sample rates for AO and AI so you won't want to share a sample clock between the tasks.  You'll need the tasks to run at different sample rates and then accomplish sync by sharing a trigger.  Working from the linked example, you could change the AI Start Trigger to be based on a digital edge, and specify the edge source as "/DevX/ao/StartTrigger".  

 

 

-Kevin P

 

CAUTION! New LabVIEW adopters -- it's too late for me, but you *can* save yourself. The new subscription policy for LabVIEW puts NI's hand in your wallet for the rest of your working life. Are you sure you're *that* dedicated to LabVIEW? (Summary of my reasons in this post, part of a voluminous thread of mostly complaints starting here).
Message 7 of 7
(681 Views)