LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

bug dissapears in debugger

I've written a program that (using traditional DAQ) acquires 2 waveforms simultaneously and analyzes them.  The way it works is that the user clicks an "acquire data" button each time he wants a new sample, as he has to change the signal by hand.  When the user runs the .exe (compiled in either debug or release mode), he can take up to  17 (no kidding) points. After the 17th point, the results start getting really wacky. However, when I open up the project and hit Shift+F5, the program runs perfectly.  So, a few questions:

Firstly , I used to be able to reproduce the bug in the debugger, and it seemed then that the two signals were out of phase. If this is because I'm abusing the poor DAQ device, is there any way to just completely reset it from within the software?

What does the debugger do that the compiled application does not? just in case there's some memory weirdness going on, what does the debugger do to memory? How does a program run within Labwindows differ from the exact same code run from double-clicking a .exe?

Y'all want a copy of the program?

Thanks




-Jason Espinosa

LabWindows 6.0
PCI-6036E
0 Kudos
Message 1 of 3
(3,058 Views)
One of the features of using the debugger is that any local function variables are automatically initialised to 0 for you: release version code will just leave these variables in an uninitialised state, unless of course you initialise them yourself. The compiler can be set to give warnings about using uninitialised variables.
0 Kudos
Message 2 of 3
(3,056 Views)

I highly recommend setting the warning for uninitialized values along with the warning for unreferenced variables. These are very useful to me as they let me avoid some common pitfalls and I can also remove unused variables avoiding unnecessary allocation of space for those variables. (That's the old-time, space/efficiency conscious programmer coming out there, I used to code things in the dim dark ages of software development where you had to worry about every byte).

The warning for assignments in conditional expressions is not so useful to me as I tend to do things like this all the time:

if ((status = hp34401a_init (DmmRsc, VI_ON, VI_ON, DmmHndl)) != VI_SUCCESS)
{
    // Do some error stuff here
}

Martin Fredrickson
Test Engineer

Northrop Grumman
Advanced Systems and Products
San Diego, CA 92128
0 Kudos
Message 3 of 3
(3,050 Views)