Jump to content

Guidance with DAQmx


jpdrolet

Recommended Posts

I'm not familiar with DAQmx and need some guidance to organize tasks settings with a PCI-6024E board.

Analog inputs: 4 channels acquired once per second. Timing is not critical, I can use software timing. I don't need waveform

Analog outputs: 2 channels. I need to update their values independently once in a while. No need for waveform generation.

Digital input: I need to detect a home position so 10Hz read update rate is sufficient. I still can use software timing.

Digital output: I need to activate a relay once in a while

Counter inputs: I need to count edges on two counters inputs.

While there are working examples for each task separately, I have to run all the above from different parts of the program. Do I need to define five tasks or can I regroup them in some way? Do digital input and output need to be on different port or can be on the same (e.g. are lines settable independently for I/O on the same port) ? Can the tasks conflict with each other, especially for timing requirement?<

Thanks

Link to comment
I'm not familiar with DAQmx and need some guidance to organize tasks settings with a PCI-6024E board.

Analog inputs: 4 channels acquired once per second. Timing is not critical, I can use software timing. I don't need waveform

Analog outputs: 2 channels. I need to update their values independently once in a while. No need for waveform generation.

Digital input: I need to detect a home position so 10Hz read update rate is sufficient. I still can use software timing.

Digital output: I need to activate a relay once in a while

Counter inputs: I need to count edges on two counters inputs.

While there are working examples for each task separately, I have to run all the above from different parts of the program. Do I need to define five tasks or can I regroup them in some way? Do digital input and output need to be on different port or can be on the same (e.g. are lines settable independently for I/O on the same port) ? Can the tasks conflict with each other, especially for timing requirement?<

Thanks

4282[/snapback]

I can't answer all your questions since I've only been using DAQmx for a short while. This is what I've learned so far:

You should configure all your individual channels as global channels first. Each global channel should be configured for each input sensor. Also, you should configure each digital IO line as a global channel. The global channel configuration defines the scaling and other parameters. Once this is done you then go and configure the required Tasks. Tasks define how you collect the data. You can create a single task that contains many global channels. In the task configuration you will define the aquisition speed and triggering etc. In you LabVIEW program you will use DAQmx task ID's not global channel id's.

Hope this helps.

Link to comment

Thanks Michael, I've found the solution myself. I don't create global tasks.

See picture. Tasks are defined separately and don't conflict.

Counters has to be set in two different tasks to read the counter values separately.

Another task for 4 analog inputs is defined elsewhere in the program.

It worked as expected the very first (correct) run :thumbup:

That is after having rebooted 3 times....

1: Oups! forgot to install NI-DAQ on target. Install and reboot

2: An error message for DMA channel not available for the task... can't figure what's up so reboot

3: Another different error message: the board is reset. Can't communicate with MAX either. Can't figure what's up so reboot.

4: The board is properly working and the program runs fine.

It's always rewarding to see a program running as expected at the first run (and that board installation problems weren't related to my code).

post-447-1112044594.gif?width=400

Link to comment

JP

Sorry for coming in late on this. I've been using DAQmx awhile and am still new to it! :wacko:

Looking at your code - you've hit the marks - only comment - do you really want to 'start' the tasks immediately after configuration? I don't know your overall code, if it's a queue state machine.

I do the DAQmx "Start" in the acquire state.

Be wary of odd performance problems using Timed loops and DAQmx...

Regards

Jack Hamilton

Link to comment
JP

Sorry for coming in late on this. I've been using DAQmx awhile and am still new to it! :wacko:

Looking at your code - you've hit the marks - only comment - do you really want to 'start' the tasks immediately after configuration? I don't know your overall code, if it's a queue state machine.

I do the DAQmx "Start" in the acquire state.

Be wary of odd performance problems using Timed loops and DAQmx...

Regards

Jack Hamilton

4362[/snapback]

I think I read somewhere in the doc/examples that it is inefficient to start/stop tasks at every iteration of continuous acquisition.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.