Program does not run with optimization on

Post your C and C++ discussions here
Post Reply
SinisterMJ
Newbie
Posts: 0
Joined: Tue May 20, 2014 6:06 am

Program does not run with optimization on

Post by SinisterMJ »

My code runs fine with Debug mode, or Release mode and disabled Optimization. When I turn optimization to maximize speed or Full Optimization, it hangs and doesn't do anything.

I have an interface class (since it may be a different oscilloscope attached other than the PicoScope), and with each other scope tested it works fine.

The code which calls the functions does this:

ScopeControl* mScope = new PicoScope();
mScope->SetConfiguration();

and then in a loop:

while(ProgramIsRunning) {
mScope->StartCapture();
// Fire the measurement system
mScope->ReadData();
}

and that loop hangs for some reason unknown to me. Anyone have a pointer what might be causing this, and only with optimization turned on?
}

Edit:
I just tried to analyze data acquired in release mode, optimization turned off, turns out, all the data returned is 0. What is happening here?
Attachments
PicoScope.cpp
The capture class itself.
(4.2 KiB) Downloaded 539 times
ScopeControl.h
The interface header
(770 Bytes) Downloaded 533 times

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: Program does not run with optimization on

Post by Martyn »

You set the g_ready flag

Code: Select all

void PREF4 CallBackBlock( short handle, PICO_STATUS status, void * pParameter)
{
	if (status != PICO_CANCELLED)
		PicoScope::PicoScope::g_ready = TRUE;
}
Is it possible the status is something else and not OK.

You may also need to issue the command ps5000aChangePowerSource if you are running after opening the scope to stop the power source return codes.
Martyn
Technical Support Manager

Post Reply