Measurement Studio for VC++

cancel
Showing results for 
Search instead for 
Did you mean: 

WFM_* Functions and NI-DAQMX with ANSI C

Hi,

I have to rewrite part of an application written using ANSI C and traditional NI-DAQ to the new NI-DAQMX library as the client is changing the DAQ boards.

One of the boards is responsible for generating analogue signals from digital samples in a file. The application
uses the WFM_Load, WFM_DB_Config, WFM_DB_Transfer, etc functions to achieve this purpose.

The documentation for NI-DAQMX does not have any equivalent of the WFM_* funtions. Do I have to use the DAQmxWriteAnalogScalar() function to generate the output waveform?

Thanks in advance.
0 Kudos
Message 1 of 5
(3,919 Views)
Yes, to write an analog output waveform you will need to use one of the DAQmxWriteAnalog functions. Those functions will take an array of data to write to a specified output channel. I have attached an example of analog output waveforms using DAQmx for you to look through if you would like.

-Alan A.
0 Kudos
Message 2 of 5
(3,912 Views)

@Alan A. wrote:
Yes, to write an analog output waveform you will need to use one of the DAQmxWriteAnalog functions. Those functions will take an array of data to write to a specified output channel.

-Alan A.




Thanks Alan. I suspected I had to do that as there wasn't a name equivalent to the WFM_* functions.

Do you know why the WFM_* functions are not available in NI-DAQMX? I suspect the DAQMxWriteAnalog() functions
perform the same task as the old WFM_Load/Transfer functions, including the use of double buffering.
0 Kudos
Message 3 of 5
(3,900 Views)
Hi TatC,

The WFM_ functions were part of the Traditional NI-DAQ C function library. The DAQmx C function library is a completely new driver and a lot of the functions from Traditional DAQ do not have a DAQmx counterpart. This is because DAQmx was written using a little bid different "task" scheme. Also, the concept of having to do "double buffering" has been removed in DAQmx. The user no longer has to specify how the double buffering will take place. DAQmx automatically uses a circular buffer for input and output operations. DAQmx's handling of the buffers is very efficient and it will allocate the proper buffer sizes automatically.

For programming in C using DAQmx, you will use the same programming flow as you would in LabVIEW. This was done to bring continuity to the different API's that use DAQmx. The basic program will go like this:

-Create task/channel
-Configure timing/triggering
-Write to buffer (if analog output)
-Start task
-Read/rewrite buffer
-Stop task

For more information, I would suggest browsing through the DAQmx C shipping examples that can be found in your C:\Program Files\National Instruments\NI-DAQ\Examples directory.
0 Kudos
Message 4 of 5
(3,892 Views)
Hi Salvador,

Thanks for the explanation of the flow of a LabView program and why the WFM_ functions were scrapped.
I'll be looking at the examples given in the Examples directory.

Hopefully the port from traditional NIDAQ to NI-DAQMX will be relatively straightfoward.

Tat
0 Kudos
Message 5 of 5
(3,886 Views)