Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DAQmxRegisterEveryNSamplesEvent

Hi,

 

being new to programming with DAQmx I am stumbling over the following problem:

 

Using the function "DAQmxReadAnalogF64" the program shall read a defined number of values from an analog input, e.g. 12,000 samples at a sample rate of 10 Hz which corresponds to a sampling period of 20 minutes. To show the progress of the acquisition process there is a numeric slide on the main panel that shall indicate the number of samples already read. With "DAQmxRegisterEveryNSamplesEvent" a callback function is established that is being called frequently during the acquisition and which contains a command to update the numeric slide control:

 

DAQmxRegisterEveryNSamplesEvent( daqtaskhandle, DAQmx_Val_Acquired_Into_Buffer, (uInt32)10, 0, EveryNCallback, NULL );

 

Although I have added ProcessSystemEvents and ProcessDrawEvents functions the numeric slide does not update until the acquisition is completed. Simple printf in the callback function gives prove that the variable used to update the numeric slide control is existing and contains the correct values.

 

So my question: Why does printf work inside the callback function but updating the numeric slide control via SetCtrlAttribute does not?

 

Your help is very much appreciated.

 

Regards,

Thomas

0 Kudos
Message 1 of 18
(4,111 Views)

Hi Thomas,

 

could you please post your code?

 

Best regards,

Melanie Eisfeld

Staff Applications Engineer

National Instruments

Best regards,
Melanie Eisfeld
Senior Applications Engineer, National Instruments Germany
Certified LabVIEW Developer
Certified TestStand Architect
0 Kudos
Message 2 of 18
(4,081 Views)

Hi Melanie,

 

thanks for your answer. Please find attached a zip file containing c, h and uir files and also the configuration file for MAX. MAX is set up to simulate a cDAQ-9188 chassis with a single 9219 module for use with thermocouples.

 

Having used the DAQmxRegisterEveryNSamplesEvent function with both possible values for the "option" parameter - 0 and "DAQmx_Val_SynchronousEventCallbacks" - the latter one does not even produce an output for printf.

 

Regards,

Thomas

0 Kudos
Message 3 of 18
(4,075 Views)

Darn! Forgot to describe my system:

 

Windows 7 Professional

Service Pack 1

 

LabWindows/CVI 2015

Full Development System

Version 15.0.0 (408)

 

Regards,

Thomas

0 Kudos
Message 4 of 18
(4,074 Views)

Hi Thomas,

 

thank you for the files.

 

However, your task in MAX in missing. Can you post a screenshot or the configuration, so I can rebuild it?

 

Best regards,

Melanie

Best regards,
Melanie Eisfeld
Senior Applications Engineer, National Instruments Germany
Certified LabVIEW Developer
Certified TestStand Architect
0 Kudos
Message 5 of 18
(4,070 Views)

Melanie,

 

here a screenshot from MAX showing the setup I am using. I did not define a task inside MAX as a task is being created in LabWindows.

 

Regards,
Thomas

0 Kudos
Message 6 of 18
(4,067 Views)

Hi Thomas,

 

if you have the task configuration file from your project, you can attach it. In the zip it was missing.

 

The task configuration means the settings for the acquisition. Your screenshot shows the device in MAX.

 

Best regards,

Melanie

Best regards,
Melanie Eisfeld
Senior Applications Engineer, National Instruments Germany
Certified LabVIEW Developer
Certified TestStand Architect
0 Kudos
Message 7 of 18
(4,061 Views)

Hi Melanie,

 

I am afraid I need your help to find the task configuration file. I send another screenshot from MAX now with a task added. You find the exported settings exported settings in the zip file. Is that what you need?

 

Regards,
Thomas

0 Kudos
Message 8 of 18
(4,032 Views)

Hi Melanie,

 

when adding a DAQ task from inside LabWindows there is an MXB file being created (see attached zip file). Is this the file you are looking for?

 

Regards,
Thomas

0 Kudos
Message 9 of 18
(3,983 Views)

Hi Thomas,

 

thank you for the file, I built my own in the meantime.

 

I get an error message when compiling your code, because the

 

#include "daqmxioctrl.h" 

 

include does not come from a system folder and the project does not contain one.

 

Did you modify or recreated this header? If so, can you provide it to me?

 

Best,

Melanie

Best regards,
Melanie Eisfeld
Senior Applications Engineer, National Instruments Germany
Certified LabVIEW Developer
Certified TestStand Architect
0 Kudos
Message 10 of 18
(3,947 Views)