LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to combine (DAQmx AI and AO with non-regeneration) with a (Producer-Consumer)?

HI, I am stuggling with it. 

 

I want the "DAQmx AI and AO with non-regeneration" in real-time with no delays in the loop. 

 

When I was using a hardware timed single point working PCI devices, there was no problem. 

 

Now I am using USB-6363, and I should configure a buffered task to do all the stuffs in hardware-timing. 

 

After searching and practicing, I've made a vi to update an output buffer with a function, while reading it with the buffered analog input task. 

 

I've heard that the Producer-Consumer is appropriate for the job that I want to do. However, there is no any single example or tutorial or an Youtube lesson that deals with actual DAQmx tasks working on a real hardware. 

 

Could you please give any recommendation to my vi and relevant idea? I guess some skilled users might have the program. Could you please open it here? Or should I pay for it to learn how to program?

 

Looking forward to your help

 

Download All
0 Kudos
Message 1 of 5
(481 Views)

Unfortunately, you are using the Most Recent version of LabVIEW (LabVIEW 2022 Q3), and many (most?) experienced LabVIEW developers "delay in installing the Latest Version" as it throws their code "out of compliance" with their colleagues running earlier versions.

 

Please open your LabVIEW Project, and select "Save for Previous Version" in the File menu.  I recommend you choose LabVIEW 2019 to allow most of the more experienced participants in this Forum to be able to open your code.  Not that I'm such an expert, but I only recently (3-4 months) installed LabVIEW 2021, and have no plans to install LabVIEW 2022 in the near future ...

 

Bob Schor

0 Kudos
Message 2 of 5
(410 Views)

Dear Bob Schor,

 

Thank you for the reply.

 

I attached the programs saved for LV2019.

 

The Queue control sample is downloaded from an article in this forum. 

 

I wonder if an interrupt-like structure can be configured using the queue structure. 

 

Please review these if you mind. 

 

0 Kudos
Message 3 of 5
(390 Views)

I looked the code over a little bit and have some comments and some further questions.

 

Comments on "MyProgram.vi":

  • Tidying your diagram will be helpful.  As a start, make sure that either the task wire or the error wire that works through all the DAQmx functions follows a straight horizontal line.  (The mix of regular functions and property nodes prevents you from doing this with both at once.)
  • You're setting more DAQmx properties than you probably need to, but I understand that you're still experimenting.  Just be aware that you won't usually need to configure most of those things explicitly.  Not allowing AO regeneration may be the only one that you *need* to configure.
  • Your choice of sample rate (12800) and # samples to read per loop iteration (128) imply a 100 Hz reading loop rate.  A more typical rule of thumb is to aim for a 10 Hz reading loop rate by reading & writing 1280 samples per iteration
  • There's no sign of a producer/consumer pattern in this vi, and it's unclear to me whether you should want one.

 

Question:

Can you give more detail about *exactly* what you want when you say:

 

I want the "DAQmx AI and AO with non-regeneration" in real-time with no delays in the loop

 

    With USB and hardware clocking, there *will* be inevitable delays between real life and your program.  Most of it will relate to the required use of buffers for tasks with hardware clocking on USB devices.  There will be a delay from the time a real-life signal changes until your program becomes aware of it via DAQmx Read.   And there will also be a delay from the time your program writes new data via DAQmx Write until that data becomes a real-life signal.

    So it's important to understand exactly what you mean by "real-time" and "no delays".  It might be impossible with your device and approach.  Or you might be really close already.  I can't tell without a much more complete description of what you want to accomplish with your app, and the specifications for what you consider "real-time" and "no delays".

 

 

-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).


0 Kudos
Message 4 of 5
(313 Views)

Dear Kevin Price,

 

Thanks for your invaluable reply. I just changed the measurement system to PCIe cards to use hardware time single point sampling. 

 

One conclusion is that usb devices are only applicable to loop rates less than 100 Hz with software timed operations. 

 

Second, for example, to achieve higher loop rate with fully available HW R/W while software computing, the only option from NI devices is the PCIe-type boards that supports HW-timed sampling. 

 

 

0 Kudos
Message 5 of 5
(236 Views)