LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

Simultaneous Analog Input and Output

I have a PCI-6110 and use MS Visual C++ or LabWindows/CVI.
In my lab, there are 2 analog voltage outputs and 1 analog voltage input. The 2 AOs should have different amplitudes, phases and frequencies.
I found this web page: http://zone.ni.com/devzone/conceptd.nsf/webmain/E1060C842FB4FB6D86256802007B90C8?opendocument .
Could anybody show me some examples for the three methods to set up simultaneous 1 analog input (AI) and 2 analog outputs (AO) operations?
1.Independent AI and AO;
2.Triggering for Independent AI and AO;
3.Synchronized AI and AO;
(Again, I have 2 AOs and 1 AI. The 2 Aos are different. I just need to generate them and synchronize one of them and the AI.)

Any help will be appreciated very much!

Yong Xia
0 Kudos
Message 1 of 4
(3,883 Views)
Yong Xia,

Greetings! You can find ready made example to do AI, AO, and triggered AI & AO already on your computer. All you would have to do is put them together into one application. You can find example programs here:

C:\Program Files\National Instruments\NI-DAQ\Examples
&
C:\Program Files\National Instruments\CVI71\samples\DAQmx

Additionally, if you want to do synchronized AI and AO, I would suggest the following link: http://sine.ni.com/apps/we/niepd_web_display.display_epd4?p_guid=B45EACE3E72F56A4E034080020E74861&p_node=DZ52337&p_source=External

You can also find several more examples by searching here:

http://www.ni.com/devzone/dev_exchange/ex_search.htm

Hope this helps,
Anuj D.
0 Kudos
Message 2 of 4
(3,883 Views)
Hi, Anuj D.:

Thank you. Could you please see the attachment? I modified the example to 2 outputs and 1 input.


The problem is I can only see the outputs for a second if I keep the value of NORMAL_MODE as 0. Then I get some error information.
If I change the value of NORMAL_MODE from 0 to 1, the outputs can last till the ITERATIONS finished. Then I get the same error information:


NON-FATAL RUN-TIME ERROR: "AIAO_Sychronize.c", line 156, col 18, thread id 0x00000758: Function WFM_DB_HalfReady: (return value == -10608 [0xffffd690]). noTransferInProgError: No transfer is in progress for the specified resource.


1. I think the value of NORMAL_MODE should be 0.
2. It seems that the outputs can start without the starting of AI, I mean, wit
hout any signal to my sensor, i.e. the input.


Could you please throw some light on these problems?


Yong
0 Kudos
Message 3 of 4
(3,884 Views)
No transfer in progress problem? I have seen this problem in my multi-threaded test sequencer program (since i could not afford to buy NI TestStand program, therefore, i built my own sequencer program specifically for my testing purpose...)

In reality, OS just blinds ur feeling about all running processes/threads will run at the same time while apparently they are time-shared so close that we don't notice it that much.

My sequencer would access MIO card which will turn on and off some switches on my test bench and at the same time will acquire analog voltage measurements from it. In my program, i would be able to create several tests that can run in parallel or sequential. I use Traditional NI-DAQ functions although simultaneous multi-threaded friendly niDAQmx functions are available in Labwindows/CVI 7.1. I implemented parallel ability by using ThreadPool and ThreadQueue support to invoke a thread for every test i initiated. Definitely when using Traditional DAQ AI support, i used the TaskID (ConfigureTask) version.

When I use TaskID version, I need to make sure that I immediately destroy the TaskID related to a test before calling another test with the same TaskID (I just keep using the same TaskID many times to save memory use). We can't call the same TaskID while it is still being used, otherwise, NI function will give error "No transfer in progress" for that test which attempts to use a running TaskID. Remember, there is no such thing as parallel execution in an OS environment that does not support parallel computing (like in general-purpose Windows OS): everything is time-shared in program context.

So my advice is to check your code for possibility of forgetting to destroy a TaskID when we want to use it again in a quick small amout of time. Forgettting to destroy TaskID in subsequent steps will deny access to hardware for other running analog I/O processes/threads that share the same TaskID.
0 Kudos
Message 4 of 4
(3,850 Views)