Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

Crash executing "DIG_In_Prt" and "HarmonicAnalyzer" at same time

Hello,
I am using a PCI-6025E to continuously acquire analog measurements and digital signals.
I want to make the THD measurement on my analog signals.
My program is divided in different threads. My system hangs (dynamic memory corrupt) when I execute the "HarmonicAnalyzer" function. All the arguments are OK prior to execute the function. Every time my system hangs, the other thread is executing the "DIG_In_Prt" function. The arguments passed to these functions are different (no global variable).
I have modified my program to avoid the execution of these function at same time (using a safe variable as traffic light). Till now it seems OK (no crash), but the execution of these functions has been slowed.
If I remove the HarmonicAnalyzer function, my program runs correctly.

1) Are these 2 functions multithread-safe?
2) Is there another way to make THD measurement?
3) If not, which is the best way to avoid two different functions to execute at same time?

I am using CVI6.0; NI-DAQ 7.1.0f1 on a Windows 2000 Professional system.

Thanks
0 Kudos
Message 1 of 3
(3,092 Views)
Hi,

Is it possible for your to post the code online, along with the error code that it produces? I would like to see if it is possible for us to reproduce it in-house.

Best regards,

Nathan
Applications Engineer
National Instruments
0 Kudos
Message 2 of 3
(3,063 Views)
Hello Nathan,
unforunately the code is quite long, and requires a serial communication with a custom application.
No return code was generated from function, only a "dynamic memory corrupt" information.

I fixed the problem using "AmpPhaseSpectrum" function and calculating the THD from the harmonic values.
Thanks

Nicola
0 Kudos
Message 3 of 3
(3,040 Views)