Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

Use AO and AI in the same program

Hello,

 

I like write a program to use AO and AI in the same program.

 

In this program write a timer a voltage to a AO port and after then it should read a voltage.

I know how I write voltage to a AO port and read a voltage on a AI port, but not in a the same program.

The read- and the write-Task, should work as soon as possible (<=1ms). 

(My timer have 100us ticks) 

 

what should I inilize for the PCI6229 card, to use AO and AI and in which order?

Can I have a example or pseudocode?

 

Best regards

Heiko Mayer 

0 Kudos
Message 1 of 7
(9,264 Views)

Hi Heiko,

 

because I don't know, which Software you are using and which Version, I just made a Labview VI for Version 8.2.

 

With this example, you can change the analog output value every loop duration.

You can control the duration time of te While loop by changing the

- Samples per channel and

- the rate.

At the moment you have a rate = 10000Hz and Samples per channel = 1000.

Because of that you loop will be executed every 0.1s (1000/10000).

 

Hope this helps

 

best regards

Dippi 

0 Kudos
Message 2 of 7
(9,239 Views)

Hello,

 

thank you for your reply.

 

>>because I don't know, which Software you are using and which Version, I just made a Labview VI for Version 8.2.

 Sorry, I had forgotten this detail.

 I program with C/C++ under the Realtime System INtime and I does not have LabView.

 Have you got this example in C/C++ for me?

 

Best regards

Heiko Mayer

 

0 Kudos
Message 3 of 7
(9,233 Views)

Hi Heiko,

 

perhaps this helps:

 

http://zone.ni.com/devzone/cda/epd/p/id/879

http://zone.ni.com/devzone/cda/epd/p/id/2352

http://zone.ni.com/devzone/cda/epd/p/id/2333

 

Best regards

Dippi 

0 Kudos
Message 4 of 7
(9,227 Views)

Hello Dippi,

 

thank you for your quick help, but I use this PCI6229 with the DDK drivers and not with DAQmx.

I need an example with DDK-instructions.

 

Best regards

Heiko Mayer

0 Kudos
Message 5 of 7
(9,222 Views)

Hi Heiko-

 

There is very little overlap between the AO and AI examples, so you should be able to piece the code together pretty easily.  I would offer these suggestions:

 

1.  These lines should only be executed once, and they should be done before any AI or AO specific initialization is done:

 

configureTimebase (board);

pllReset (board);

analogTriggerReset (board);

 

2.  It does not matter which order you perform the AI or AO initialization, but I would recommend waiting to unground the AO reference (by  

board->AO_Calibration.writeAO_RefGround (kFalse);) until all of the AI and AO init is done.  This will help to avoid any glitching on the AO lines.  The only steps that should be saved until after ungrounding the reference are the Start operations for AI and AO (depending on the AO mode you use, there may not be a specific Start operation to call.  Consult the MHDDK examples for more info about the required steps).

 

Hopefully this helps-

Tom W
National Instruments
0 Kudos
Message 6 of 7
(9,220 Views)

the program worked for me

 

AO_AI()

{

   test( bus ) ; // function from aoex1.cpp

   test( bus ); // function from aiex1.cpp

}

 

0 Kudos
Message 7 of 7
(9,201 Views)