Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxBaseCreateAIVoltageChan Failure with error -50251

Hi all,
I am using Delphi to build an application to run my DAQ device through the DAQmxBase driver. I am loading the
routines exported from NICAIU.DLL. The routine DAQmxBaseCreateAIVoltageChan is failing to execute, returning
error code -50251, extended error "Specified software component is not available. The component was not loaded"
I am declaring the routine in my code as:
function DAQmxCreateAIVoltageChan(TaskHandle:TTaskHandle;
PhysicalChannel: Pointer;
NameToAssignToChannel: Pointer;
TerminalConfig: int32;
MinVal: float64;
MaxVal: float64;
Units: int32;
CustomScaleName: Pointer): int32;
stdcall; external 'NICAIU.DLL';
and I am calling as:
DAQmxCreateAIVoltageChan(AITask, Buffer, nil,DAQmx_Val_Diff,MinInput,MaxInput,DAQmx_Val_Volts, nil);
All the variables I have already used in other routine calls with no error. The only thing I am not sure in the call as above is the use of the nil constant as the equivalent in ANSI C of the null array of Char, but the error message does not seem to be related to this sort of error.
I would appreciate if someone could give me hint as how to overcome this problem.
Thanks in advance
0 Kudos
Message 1 of 6
(3,028 Views)
Hi DelphiUser_01,

The following KnowledgeBase should be helpful:

How Can I Use The NI-DAQmx ANSI C Function Library With Borland C and Delphi?

Thanks,
Lesley Y.
0 Kudos
Message 2 of 6
(3,009 Views)
Would you mind sharing your interface to the DLL?

ALl we need to do is get the temperature from a NI-USB-9161.
Thanks
0 Kudos
Message 3 of 6
(2,966 Views)
Many thanks for the tip. It worked just fine.

Alexei
0 Kudos
Message 4 of 6
(2,940 Views)
Hi optoguru
Please find attached the zip file comprising the NIDAQload.pas unit which directly imports the DAQmx routines from the NICAIU.DLL (check for this dll at \Windows\System32) and the unit ExpSetup.pas which uses the former unit to call the routines. The NIDAQload unit includes the IntializeFPU and Restore FPU routines which solves the problems with the error -50251. Notice that the NIDAQload is a translation from the C include file supplied by NI and although all the constants declarations have been translated to Delphi, some of the declarations of functions I did not use in my code have not been translated and are still commented in the file. If you need any of these latter you can translate them using similar declared routines as template.
All the routines I am using in my code are working fine, but be aware that I have not tested all the routines declared in NIDAQload.pas. If you find any bug or if I can be of any further help just let me know.

Alexei
0 Kudos
Message 5 of 6
(2,933 Views)
In time. I am using NIDAQmx not NIDAQmxBase.
0 Kudos
Message 6 of 6
(2,929 Views)