Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Different board types with NI-DAQmx and other questions

Dear all,

 

I am encountering several problems porting a Traditional NI-DAQ app to NI-DAQmx, while transitioning to new PCI-X hardware.

 

Configuration

======== 

Vista Service Pack 2

NI-DAQmx  9.1

- PCI-6110

- PCIe-6259

- PCIe-6321

- RTSI cable between the three boards, configured under MAX

- Using straight NI-DAQmx API calls with Delphi

 

 

The application uses either 1, 2 or 3 boards depending on user configuration. The program runs simultaneously at least:

- one analog out task on the PCI-6110, 2 analog channels out (Task 1)

- one analog in task on the PCI-6110, 1-4 analog channels in (Task 2), with callbacks every n samples enabled

 

and optionally:

- one analog out task on the PCIe-6259, 3 analog channels out (Task 3)

 

- one analog in task on the PCIe-6321, 1-8 channels in (Task 4), with callbacks every n samples enabled 

- one buffered timer task on the PCIe-6321, one counter (Task 5) driving analog and digital outputs (Tasks 6 and 7)

- one analog out task on the PCIe-6321, 2 analog channels out (Task 6)

- one digital out task on the PCIe-6321, 8 digital out lines out as a combined port (Task 7)

 

The program is organized around Task 1 which provides a common trigger and clock for all other tasks, i.e., everyone is synchronized by Task 1.

 

 

Weirdness #1

========= 

In a minimal run, only tasks 1 and 2 are involved. Upon user intervention, Tasks 1 and 2 are created, activated, perform their job and are cleared (this is what I call a run).

 

The bizarre thing is that the callback function in Task 2 works properly only during the second run or afterwards. The first time the sequence

(Tasks 1 and 2 created, run and cleared) is performed, the callback in Task 2 never triggers even if I reset the three devices before the run. I am wondering if this could be an initialization problem in the NI-DAQmx library. The second and subsequent runs work perfectly, all function calls return OK for each run.

Has anyone seen this? 

 

 

Weirdness #2

========= 

Tasks 4-7, which run on a PCIe-6321 work fine by themselves. When Tasks 4-7 are combined with tasks 1 and 2 (on the PCI-6110), erratic behaviors occur, with intermittent triggering, callbacks in Task 4 triggered only during the first run, occasional crashes in NI-DAQmx etc... Sorry I cannot be more explicit, the program is quite complex. My questions are:

 

- can you mix PCI, M-series and PCI-X boards through RTSI?

- I don't understand the callback business when a program needs to run several callbacks simultaneously. Do you have to setup the callbacks in a different thread for each callback?

- Do you recommend using one thread per task if this task registers a callback?

 

 

Thanks for the help.

 

 

0 Kudos
Message 1 of 2
(2,949 Views)

Whats your programing environmnent? In some of the C libraries found in cvi, you can receive callbacks in a system-created thread. Because these libraries automatically create threads that execute your callbacks, you do not have to create threads or schedule a function to run in a separate thread. You still have to protect data that is shared between these threads and other threads in your program. Implementations of these callbacks are typically referred to as asynchronous events. See this document on multithreading in cvi

Message Edited by p.sanders on 06-10-2010 11:12 PM
0 Kudos
Message 2 of 2
(2,915 Views)