Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

nidaqmx.pas

I am trying to program a NI -PCI 6251 board in Delphi 2006 Developer Studio (Delphi Pascal), using the ANSI C Examples.  I am using the nidaqmx.pas and NIDAQmxCAPI_TLB files that were provided in the NI support fora.  I am able to successfully accomplish some things, like controlling the digital output. 

The problem that I am having is that some of the constants declared in the NIDAQ C Reference Help and NIDAQ C examples apparently are not defined in the Pascal files.  For example, I am currently trying to get analog output using the ContGen-IntClk.c example.  This example calls the following function:

DAQmxCfgSampClkTiming

one of whose parameters is SampMode, which is set to DAQmx_Val_ContSamps in the example.  While I can find the definition for DAQmx_Val_ContSamps in the nidaqmx.h C header file, there apparently is no such definition in the nidaqmx.pas file or NIDAQmxCAPI_TLB file.  Are there updated files that I can use, or is there some way to generate the appropriate definitions automatically (it says something to this effect in the top of the NIDAQmxCAPI_TLB file), or can I simply copy the definitions from the nidaqmx.h file to one of the Pascal header files?

Venkat Chandrasekhar
0 Kudos
Message 1 of 4
(4,725 Views)

Hello Venkat,

Currently DAQmx is not supported for Delphi Pascal. We do have wrappers available, however they have not been fully tested. I am assuming that you are using these wrapper files, which can be found at the following location: Can I Make NI-DAQmx Calls From Borland Delphi?. These are the most up to date files we have for Delphi Pascal support. You can modify these files to include definitions, provided you define them as documented in the ANSI C help files.

I hope this helps!

Regards,

Chris Behnke
Sr. RF Engineer
High Frequency Measurements
0 Kudos
Message 2 of 4
(4,713 Views)
Dear Chris,

Thanks.  It turns out that there is a difference in the numerical constants between the wrapper files between different versions of NIDAQmx.  What I had to do was to regenerate a Pascal wrapper file directly from the newest type library (nidaqmx.tlb in Windows/system32)..this is the file NIDAQmxCAPI_TLB using the Import Type Library feature in Delphi.  This gives you a Pascal interface (NIDAQmxCAPI_TLB.pas) to the type library, which you can then use.  So far, I have been able to get digital and analog output to work, and I do not see why there should be a problem with other types of output or input.  A problem that threw me off initially is that the names of the constants are different from the ones in the NIDAQ C Help reference, so one actually has to do a manual search on the type declaration to discover the constants.

Two other questions, however.  I did not find any examples of double-buffered analog output in the ANSI C examples,  Is double-buffering automatically taken care of in NIDAQmx?  I would like to output a fairly large amount of data to both analog outputs of my 16-bit  PCI-6251 board without buffer under or overruns.  For traditional NIDAQ, I had to use double-buffering. Second question: the update rate at which I would like to do this is quite fast, almost at the limit of my board (5 ns update for both channels). The DAQmxCfgSampClk function seems only to take a frequency.  Will this be accurate enough, and are there any errors in converting time to frequency?

Finally, as has been done by other posters, I would like to request that NI re-institute support for Delphi Pascal.  It is a great language, far better than Visual Basic for these types of things, and heavily used in many research labs around the world.

Thanks for your help.

0 Kudos
Message 3 of 4
(4,704 Views)

Hello Venkat,

I am glad that you were able to get the wrappers working properly. Let me try to answer your questions.

1. Double buffering was a concept used with the Traditional NI-DAQ driver. With DAQmx, double buffering is has been replaced by the concept of the circular buffer. To achieve this, simply set the acquisition mode of the DAQmx timing function to continuous. The buffering will then be handled for you by DAQmx.

2. The maximum sample rate of the 6251 is 1.25 MS/s on a single channel. This means you can read a signal up to 625 kHz (1.6 us) and still maintain Nyquist. When using multiple channels, the maximum sample rate becomes 1.00 MS/s aggregate. This means that this sample rate is split over the number of samples used. A 5 ns update rate would correspond to a 200MS/s sample rate.

An additional important aspect to keep in mind is that the maximum sample rate is divided down by N to achieve lower sample rates, where N is an integer. This is important to keep in mind when selecting the sample rate.

I hope this clears some issues up.

Regards,

Chris Behnke
Sr. RF Engineer
High Frequency Measurements
0 Kudos
Message 4 of 4
(4,688 Views)