09-29-2016 08:31 AM
Hi
When I acquire voltage and Freq data using PCI6221, I select a producer/consumer architecture with three loops,which are events loop,daq loop and error loop,I put the analog read VI and counter read VI in the same state that in DAQ loop, but when freq sensor runs slowly or stop, the counter VI will wait data to come,which always lead the analog buffer overflow.Anyone knows what should I do if I must use producer/consumer architecture because of the complex controlling need.
Thanks.
09-29-2016 08:57 AM
I can think of a couple alternatives for you.
1. Structure the code that queries the counter task to be more forgiving of this kind of expected situation. That'll involve not waiting for a long timeout on the Read, because during that long wait the AI task gets a buffer overflow.
You could query and store a DAQmx Read property like "Total Samples Acquired" or "Available Samples". Comparing the present value to the former value lets you know how much data is there to read, if any. From there you can decide whether to call the Read function or not. Maybe it makes sense for you app to generate dummy data to report 0 frequency.
2. Maybe the two different DAQ tasks can be in separate loops so they don't interfere with each other. However, it could get tricky trying to keep their data in sync when you separate them.
-Kevin P
09-30-2016 02:17 AM
09-30-2016 08:59 AM
It'll help if you can post your code.
You're right about the limitations of "need mode" (also called software-timed or on-demand). You should plan to set up a buffered task with a call to DAQmx Timing, and it definitely *should* be called (as should DAQmx Start) before entering your acquisition loop.
The data overflow problem is probably pretty solveable. Without seeing code, my first guess is that you aren't properly accounting for the different acquisition rates of AI and CI, maybe requesting the same # samples from both tasks?
-Kevin P
10-07-2016 08:29 PM
I am sorry for replying you so late becasue of the seven-day holiday.
If I set up a bufferd task, data will over flow,so I selected the on-demand mode at present.
And, when I select the signal channel, I found no matter I selected the SRC or GATE, the program have no difference. I used the inner clock, what is going on?
Thanks a lot for your help.
Best regards.
10-10-2016 12:17 PM
Certain kinds of counter overflow errors can be caused by very high frequencies or noisy signals (that generate high-frequency edges). I'd recommend some careful troubleshooting with MAX or example programs to investigate. While troubleshooting, try using the "high frequency with 2 counters" measurement method at the beginning of config where you create your task.
-Kevin P
10-10-2016 08:24 PM
Hi Kevin
Thanks for your help and patience.
The trouble may mainly be caused by the sensor, or my low programming level using LabVIEW.
Now, I have completed the testing system by using a little complex manual operation to make up the shortage of the program.