From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxRegisterDoneEvent not working in Win64 but working in Win32

Solved!
Go to solution

Dear All,

 

We have a problem with DAQmxRegisterDoneEvent on Windows 7 64-bit but not Windows 7 32-bit.

We have two versions of our app, one for Win32 and the other for Win64 - same code, just recompiling for the appropriate target. The NIDAQmx code controls a PCI-6110S.

 

 

In either case we call:

 

DAQmxCreateTask

DAQmxCreateAOVoltageChan

DAQmxCfgSampClkTiming with DAQmx_Val_FiniteSamps

DAQmxRegisterDoneEvent with the address of our callback

 

The callback registered with DAQmxRegisterSignalEvent should fire after a fixed number of samples are issued on the analog channels. It does it under Win32 but not Win64. It is never called.

 

It's unlikely to be a callback declaration problem (nothing crashes) or a performance issue (too many callbacks) as the callback should happen every ~ 0.3 s.

 

 

The Win64 config is Win7 Pro NI-DAQmx 9.5.1

 

Has anyone seen this?

 

Thanks to all.

 

 

0 Kudos
Message 1 of 6
(3,125 Views)

Hey Victor65,

 

I have few questions, what do you mean by "compliled code"? I only ask because some of our customers make execuables from their VIs and other do it from some textbased languages. It sounds like you're using some text based language. If you are, can you tell me the libraries those functions are from as well as the version of those libraries? It would also help to have the windows 32 bit configuration information as well (os and version of NI-DAQmx)

 

Thanks,

 

-KP

Kurt P
Automated Test Software R&D
0 Kudos
Message 2 of 6
(3,110 Views)

Dear Kurt,

 

The application is text-based. It is written in Delphi (XE2) which allows targeting either Win32 or Win64 just by recompiling. The header of the NI-DAQmx library was translated to Object Pascal.

 

function DAQmxRegisterDoneEvent(taskHandle: TTaskHandle; options:Longint; callbackFunction:Pointer; callbackData:Pointer):Longint; stdcall;

Note: Longint is the same as an int32.

 

We also use DAQmxRegisterSignalEvent, a function in the same group as DAQmxRegisterDoneEvent.

function DAQmxRegisterSignalEvent(taskHandle: TTaskHandle; signalID:DAQmxSignal2; options:Longint; callbackFunction:Pointer; callbackData:Pointer):Longint; stdcall;

 

DAQmxRegisterSignalEvent, unlike DAQmxRegisterDoneEvent, works fine in Win64, i.e. it properly registers a callback which is called without problems.

 

In Win32, DAQmxRegisterDoneEvent and DAQmxRegisterSignalEvent calls are aliased to their _VB6 equivalent. In Win64, those calls directly map to their function names in "nicaiu.dll".

 

 

The Win32 version runs on Windows 7 32-bit with NI-DAQmx 9.1.1

The Win64 version runs on Windows 7 64-bit with NI-DAQmx 9.5.1

 

Thanks for helping.

 

 

 

0 Kudos
Message 3 of 6
(3,102 Views)

At first I thought this might be a linking problem but you're not getting any errors. The really strange part about this is the lack of errors. I wonder if you can get the DAQmxRegisterDoneEvent to work just with a simple program. I'm not sure how robust your application is, but it would be worth a shot to see if you can build a smaller application to use that function. Also, which compiler are you using?

 

Let me know the results,

 

-KP

Kurt P
Automated Test Software R&D
0 Kudos
Message 4 of 6
(3,078 Views)
Solution
Accepted by topic author Victor65

My mistake.

DAQmxRegisterDoneEvent is working fine in Win32 and Win64.

 

The bug was introduced by incorrectly declaring DAQmxCfgSampClkTiming in the 64-bit program. The task never triggered a done event because the sample count parameter in  DAQmxRegisterDoneEvent was incorrectly passed.

 

 

 

0 Kudos
Message 5 of 6
(3,017 Views)

Hey Victor,

 

Thanks for updating this with the solution, we really appreciate complete threads.

 

Best of luck in the future,

 

-KP

Kurt P
Automated Test Software R&D
0 Kudos
Message 6 of 6
(3,007 Views)