07-08-2016 10:06 AM
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
07-11-2016 03:39 AM
Hi Thomas,
could you please post your code?
Best regards,
Melanie Eisfeld
Staff Applications Engineer
National Instruments
07-11-2016 06:02 AM
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
07-11-2016 06:05 AM
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
07-11-2016 07:28 AM
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
07-11-2016 08:00 AM
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
07-11-2016 08:12 AM
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
07-12-2016 10:17 AM
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
07-14-2016 10:00 AM
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
07-18-2016 09:47 AM
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