Test and Measurement Forum

"ps4000GetStreamingLatestValues " compilation problem

Post general discussions on using our drivers to write your own software here

"ps4000GetStreamingLatestValues " compilation problem

Postby OMa2 » Mon Apr 26, 2010 10:18 am

Hi,

I'd like to use the streaming mode of the PicoScope4224.

My streaming callback fct is :
----------------------
void TestStreamingCallBack ( short handle,
long noOfSamples,
unsigned long startIndex,
short overflow,
unsigned long triggerAt,
short triggered,
short autoStop,
void *pParameter
)
{

}

--------------------------

Then I use "ps4000GetStreamingLatestValues"

CurrentStatus = ps4000GetStreamingLatestValues( Handle, TestStreamingCallBack, NULL );


But compiler complains that :

error: invalid conversion from 'void (*)(short int, long int, long unsigned int, short int, long unsigned int, short int, short int, void*)' to 'void (*)(short int, long int, long unsigned int, short int, long unsigned int, short int, short int, void*)'
F:\nCview\src\windowsampledsignalsacquisition.cpp:309: error: initializing argument 2 of 'PICO_STATUS ps4000GetStreamingLatestValues(short int, void (*)(short int, long int, long unsigned int, short int, long unsigned int, short int, short int, void*), void*)'


Any help would be greatly appreciated

Sincerely
Olivier
OMa2
Newbie
 
Posts: 0
Joined: Mon Apr 26, 2010 10:07 am

Re: "ps4000GetStreamingLatestValues " compilation problem

Postby Robin » Tue Apr 27, 2010 3:55 pm

Hi

The best starting point is to have a look at ps4000con.c in the SDK.

The SDK can be downloaded via www.picotech.com/software.html

Robin
Robin
Zen Master
Zen Master
 
Posts: 558
Joined: Fri Sep 19, 2008 10:17 am

Re: "ps4000GetStreamingLatestValues " compilation problem

Postby OMa2 » Thu Apr 29, 2010 8:56 am

Ok for some reason I had to do the cast "(ps4000StreamingReady)" :

CurrentStatus = ps4000GetStreamingLatestValues( Handle, (ps4000StreamingReady)WindowSampledSignalsAcquisition::StreamingReadyCallBack, NULL );


I should say that function WindowSampledSignalsAcquisition::StreamingReadyCallBack is declared as static so it has the right signature (I mean "this" pointer isn't required ).


Still, in the following code, it seems that callback function is never called by the driver.

//****************************************
// Run streaming.
unsigned long CurrentTimeInterval;
StreamingAutoStopFlag = false;
CurrentStatus = ps4000RunStreaming( Handle, &CurrentTimeInterval, PS4000_NS, 0, 0, true, 1, BufferLength );
if( CurrentStatus != PICO_OK )
{ wxMessageBox( "Error running streaming.\n\nExiting.", "PicoScope error", wxICON_ERROR );
return;
}


// Streaming loop.
while( StreamingAutoStopFlag == false )
{
/* Poll until data is received. Until then, GetStreamingLatestValues wont call the callback */
Sleep(10);
StreamingDataReadyFlag = false;

CurrentStatus = ps4000GetStreamingLatestValues( Handle, (ps4000StreamingReady)WindowSampledSignalsAcquisition::StreamingReadyCallBack, NULL );
if( CurrentStatus != PICO_OK )
{ wxMessageBox( "Error when trying to get values.\n\nExiting.", "PicoScope error", wxICON_ERROR );
return;
}

if( StreamingDataReadyFlag == true )
{
wxString Msg;
Msg << "Collected " << StreamingBufferCurrentLength << " samples \n\n";
Msg << "Buffer index = " << StreamingBufferCurrentIndex << "\n\n";
Msg << "Dummy = " << StreamingDummy ;
M(Msg);
}


};
OMa2
Newbie
 
Posts: 0
Joined: Mon Apr 26, 2010 10:07 am


Return to General Software Discussions

Who is online

Users browsing this forum: No registered users and 0 guests