Showing results for 
Search instead for 
Did you mean: 

DAQmx query code





I have just started using NI PCI 6221, and have no experience with daqmx ,


NI PCI 6221 : 16 AI -- 2 AO


My basic problem statement is to  generate a sine wave give it on ao and then i have connected physically ao with ai of the pci card, then read and analyze the signal from ai.


can anybody provide a good example to do ao & then ai in the same program,





Message Edited by Cool : ASDF on 02-19-2010 12:31 PM
0 Kudos
Message 1 of 16

You should start by looking at the examples that are installed when you install DAQmx. Help -> Find Examples -> Hardware Input and Ouput -> DAQmx.


You should also look over the material in the Developer Zone: Getting Started with NI-DAQmx: Main Page

0 Kudos
Message 2 of 16



Is there any specific example in which both the cases are used



thanks for reply

0 Kudos
Message 3 of 16

You would just need to combine an analog output example with an analog input examples.


Note: I provided the incorrect link for the page. Correct link: Getting Started with NI-DAQmx: Main Page


0 Kudos
Message 4 of 16

Can you provide some ex,

i tried but i am get all types of errors (200230,200798) etc

i am attaching my ex can you suggest anything in it as the generated sine is not coming at the output,

0 Kudos
Message 5 of 16
The attachment didn't make it. The first error code has to do with a null pointer. Not sure how you'd be getting this. I can't even find the other error code.
0 Kudos
Message 6 of 16
sorry i forgot to attach
0 Kudos
Message 7 of 16

The DAQmx Popup for DSA seems to come from the Sound and Vibration Toolkit which I don't have. I did not see anything immediately wrong. When I remove the DAQmx Popup for DSA and ran the VI using a simulated PCI 6221 the code ran without errors. Were you trying to run it in highlight mode? If you were you'd get the -200279 error which means you weren't keeping up with available data.



  • You should use one button to stop both loops. There's a variety of ways to do this.
  • You should also stop the loop if an error occurs out of the DAQmx VIs.
0 Kudos
Message 8 of 16







Thanks for replying but the sine wave which i am producing is not generated as it is.



as well as when i use the express vis the code runs perfectly what can be the possible reason,


i am attaching the express vi below,



0 Kudos
Message 9 of 16

The VI you posted that uses Express VI doesn't have the tasks configured the same way as the code that doesn't use Express VI, so I'm not sure what you're doing anymore. Why do you have a separate Simulate Signal Express VI to create an offset as opposed to just using the "offset" input of the Simulate Signal Express VI. Did you write both VIs? Based on the coding style it seems unlikely.


I also don't understand what you mean by "but the sine wave which i am producing is not generated as it is."

0 Kudos
Message 10 of 16