Test and Measurement Forum

Program does not run with optimization on

Post your C and C++ discussions here

Program does not run with optimization on

Postby 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 262 times
The interface header
(770 Bytes) Downloaded 263 times
Posts: 0
Joined: Tue May 20, 2014 6:06 am

Re: Program does not run with optimization on

Postby 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
Site Admin
Site Admin
Posts: 3217
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Return to C and C++

Who is online

Users browsing this forum: No registered users and 0 guests