LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

converting NIDAQ application to NIDAQmx

Hello,

I've been given the task of making an in-house application written in CVI work with 6221-M boards. This application was originally written with AT-MIO-16 drivers, for an AT-MIO board; it works fine with 6221-E boards via the legacy NIDAQ drivers.

My understanding is that I need to 1) learn the NIDAQmx API; 2) learn enough of the NIDAQ API to see the design of how the original author wrote this application; and 3) write the new program essentially from scratch.  Is this correct? 

My second question: there isn't any sort of compatibility layer for the old NIDAQ and the 6221-M board, is there?

Thanks.
-Daniel
0 Kudos
Message 1 of 5
(3,428 Views)
I have ported a few nidaq based programs to nidaqmx in past.  It should not be too difficult.  Step 1 and 2 are basically correct but you can probably do this on the fly as you port each procedure over from the legacy code.  As for three, it is not really a case of working from scratch but simply finding the equivalent nidaqmx function calls to replace the obsoleted nidaq calls and reformating the parameters. 
The example programs for nidaqmx found under "Help==>Find Examples==> Hardware Input and Output" are a really good place to start when trying to implement specific nidaqmx procedures.
The single biggest difference when porting to nidaqmx from nidaq is that nidaqmx uses a "Task" for each "function" that you have your hardware perform.  Each of these tasks has a taskhandle that you need to keep up with.  If the original program was sufficiently modular it is usually trivial to just open and configure each task when the program is started and close them when the program exits.  The taskhandles can be stored in an array or structure for easy access.
 
I will have to defer the answer to your second question to someone else. 
Message 2 of 5
(3,423 Views)
MVR, thanks for the advice and for the pointer to the particular examples.

This is going to be a somewhat involved project, with about 10k lines of non-NIDAQ-library c code.  Unfortunately,  it's not terribly modular, so I'm going to probably need to do some refactoring as I go as well. 

Ah well; I can be philosophical and think about how much improvement I'll make for whomever is responsible for maintaining it after me.

I'll have more questions, soon, I'm sure.  Thanks again.
0 Kudos
Message 3 of 5
(3,414 Views)
Hi Daniel,

Since your transitioning from Traditional DAQ to DAQmx, I thought I would give you a few helpful links such as Using NI-DAQmx in LabWindows/CVI, Getting Started with NI-DAQmx and Transitioning from Traditional NI-DAQ (Legacy) to NI-DAQmx Using ANSI C and NI LabWindows/CVI (its a 4 part series and its really helpful).

Hope this helps!

Best Regards,
Jonathan N.
National Instruments
Message 4 of 5
(3,409 Views)

Good luck and post again if you have issues. Jonathan posted some pretty good links.  I looked them over, it looks more complicated than it actually turns out to be.  Not really difficult, but can be tedious and take a lot of time. 

If you are short on time you can create you own routines to mimic the legacy nidaq calls (the basic features like DIO, AI, AO) in a separate file and encapsulate all the nidaqmx specific stuff related to tasks within that file.  You then just replace the old nidaq header with your new one and adjust the legacy nidaq function calls in the other source code as required.  It can be very strait forward to port stuff this way.  I have worked with NI stuff for along time, and they maintain some of the best backward compatibility and forward migration paths of any environment I have worked with.  Very important in our business.

0 Kudos
Message 5 of 5
(3,398 Views)