Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

delphi 2010

Hello,

 

I developed DAQ software using Delphi 6, but trying to use one and the same project with Delphi 2010 get Error calling the very first function call

 

DAQmxRestDevice(PChar('DEV1')) ;  -->  results  error -20020  "unknown device"

 

I started "NI Spy" and see calling this function in Delphi 2010, just the the first char of the string is passed like  " DAQmxRestDevice('D'))". Both Applications use the same file "nidaqmx.pas" which calls "nicaiu.dll".  I checked also are compiler options but find no reason why it works with Delphi 6 and not by Delphi 2010.

 

Any idea is greatly welcome

 

 

hassan

 

 

 

 

0 Kudos
Message 1 of 5
(4,484 Views)

Hi Hassan,

 

unfortunately the actual versions of the DAQmx driver software do not support Delphi anymore. Nevertheless there's a NI-DAQmx C import library for Borland, please see this link

 

Regards,

Bernd

 

 

 

 

0 Kudos
Message 2 of 5
(4,469 Views)

The found the following convertion which helped: 

 

DAQmxRestDevice(PChar(PAnsiChar(AnsiString('DEV1'))))

 

i used  just "nidaqmx.pas".

 

 

 

Regards,

 

Hassan

0 Kudos
Message 3 of 5
(4,452 Views)
The absence of official support of interaction between NiDAQmx driver and RAD Borland (Embarcadero) Delphi is the actual problem. Many application developers want to support existing projects and develop new ones using the familiar programming environment. However, we suppose that new-created Delphi projects must support various DAQ cards and operation systems of the Windows family including 64-bit versions. Existing Delphi applications written with the legacy Traditional NiDAQ driver must be easy converted to work with a new NiDAQmx driver.



There are two methods to solve this problem partially.



1. Using TDAQ7.4 for Windows Vista. This method allows to use existing Delphi applications for Windows Vista x86 and Windows 7 x86. But this driver doesn’t support a lot of modern DAQ cards and doesn’t work in 64-bit operations systems. Using TDAQ7.4 driver for Windows Vista can be only a temporary solution.



2. Using wrappers for the nidaqmx.dll library. The limitations of this method are dependence between NiDAQmx version and wrapper version (changing of driver’s version involves changing wrapper); nidaqmx.dll functions are not well documented; there are strange bugs and memory leaks; 64-bit operation systems are not supported yet; working of this method is not guaranteed at all.



I want to propose a new solution of interaction of the NiDAQmx driver and Borland Delphi. The essence of the approach is described below.



1. Create .NET-assembly using Microsoft Visual C# 2008 Express Edition (for example), in which describe one or several objects contained necessary DAQ-functionality.

2. Select names of methods, properties and events corresponding with name of old driver’s members. This creates an opportunity to simplify the process of remaking existing Delphi applications.

3. Register the assembly for Com Interop.

4. Import the .NET-assembly in Borland Delphi. Now we have an object the same as, for example, ActiveX object with an encapsulated necessary DAQ-functionality.



Advantages of described approach are:
Working with all DAQ-cards in all operation systems including 64-bit ones.
Independence from NiDAQmx versions.
You need only free Microsoft Visual C# 2008 Express Edition (for example), you don’t need any expensive software.
An opportunity to use Delphi as basic software for DAQ application development.



Using described method I have already created .NET assembly with realization several functions for one-shot digital reading and writing, continuous analog reading, one-shot analog writing (I need only this functionality for my own applications).


If this topic is interesting for you please write me karpesh@mail.ru or soft@electrolab.ru (English and Russian available).
0 Kudos
Message 4 of 5
(4,275 Views)

Where do you find nidaqmx.pas ?

I have application in Delphi XE which using different ADC devices (not NI) to make analog mesurements, and now I need to extend functionality by adding cDAQ9178 with 9203 module. Broadly speaking, i set up sampling frequency, measuring time and read channels data, thats all. What is the simplest method to do it in Delphi?

I have read suggested idea with NET-assembly but im not familiar with Visual studio and NET, and i Believe there should be easy solution, for using just couple functions (configure channels and read).

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