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
(1,117 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

-------------------------------------------------------
Control Lead | Intelline Inc
Message 2 of 7
(1,109 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
(893 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.

-------------------------------------------------------
Control Lead | Intelline Inc
Message 4 of 7
(887 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
(879 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. 

-------------------------------------------------------
Control Lead | Intelline Inc
0 Kudos
Message 6 of 7
(873 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

 

ALERT! LabVIEW's subscription-only policy coming to an end (finally!). Permanent license pricing remains WIP. Tread carefully.
Message 7 of 7
(865 Views)