Program does not run with optimization on

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

Program does not run with optimization on

Post by SinisterMJ » Tue May 20, 2014 6:22 am

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();

and then in a loop:

while(ProgramIsRunning) {
// Fire the measurement system

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?

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?
The capture class itself.
(4.2 KiB) Downloaded 348 times
The interface header
(770 Bytes) Downloaded 341 times

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

Re: Program does not run with optimization on

Post by Martyn » Wed May 28, 2014 10:12 am

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.
Technical Support Manager

Post Reply