PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
[...]
[21:16:23] [Debug] PicoScope5000(0xff7fc0) Opening the device...
WaitForMultipleObjects Complete
[21:16:26] [Debug] PicoScope5000(0xff7fc0) Handle: 16384
[21:16:26] [Debug] PicoScope5000(0xff7fc0) Device opened!
[21:16:26] [Debug] PicoScope5000(0xff7fc0) on_connected
[21:16:26] [Debug] PicoScope5000Channel(0x1042f10, name = "0") on_connected
[21:16:26] [Debug] PicoScope5000(0xff7fc0) Channel 0 set to true
[21:16:26] [Debug] PicoScope5000Channel(0x1049e88, name = "1") on_connected
[21:16:26] [Debug] PicoScope5000(0xff7fc0) Channel 1 set to false
[21:16:34] [Debug] PicoScope5000(0xff7fc0) Memory Segments set to 1 . Max Samples per capture 33553982
[21:16:34] [Debug] PicoScope5000(0xff7fc0) Number of Captures set to 1
[21:16:34] [Debug] PicoScope5000(0xff7fc0) runBlock worked!
[21:16:34] [Debug] PicoScope5000Channel(0x1042f10, name = "0") Deleting old traces
[21:16:34] [Debug] PicoScope5000Channel(0x1042f10, name = "0") Allocating Traces
[21:16:34] [Debug] PicoScope5000Channel(0x1049e88, name = "1") Deleting old traces
[21:16:34] [Debug] PicoScope5000(0xff7fc0) Callback
[21:16:34] [Debug] PicoScope5000Channel(0x1042f10, name = "0") Setting Data Buffers for 1 traces
[21:16:34] [Debug] PicoScope5000(0xff7fc0) Channel: 0 Bufferaddress: 0x4cc7f48 bufferSize. 10000 waveform: 0
[21:16:34] [Debug] PicoScope5000(0xff7fc0) ps_setDataBufferBulk worked
[21:16:34] [Debug] PicoScope5000Channel(0x1049e88, name = "1") Setting Data Buffers for 0 traces
[21:16:34] [Debug] PicoScope5000(0xff7fc0) Downloading Data from Scope
[21:16:34] [Debug] PicoScope5000(0xff7fc0) noOfWantedSamples: 10000 fromSegmentIndex: 0 toSegmentIndex: 0
[21:16:34] [Debug] PicoScope5000(0xff7fc0) ps_getValuesBulk worked
[21:16:34] [Debug] AbstractPlot(0x1048d88, name="AbstractPlot") New Traces available
[...]
Code: Select all
Model: PicoScope 5203
Serial number: AT062/60
USB-Version: 2,0
Calibration Date: Friday, 16. July 2010
Hardware version: 1
Driver version: 1.4.2.434
Code: Select all
#include
#include
#include "picoStatus.h"
#include "ps5000Api.h"
using namespace std;
short m_handle;
PICO_STATUS status;
int main(int argc, char *argv[])
{
// Settings
int nSegments = 1;
int nNoOfCaptures = 1;
uint32_t noOfWantedSamples = 100; // Posttrigger
// Alloc buffer, set all to zero
short* traceBuffer = (short*) calloc(noOfWantedSamples, sizeof(short)*noOfWantedSamples);
// Open Device
status = ps5000OpenUnit(&m_handle);
if (status != PICO_OK){
cout << "Unable to open device." << "Error code:" << status << endl;
return 1;
}
else cout << "Device opened!" << endl;
// Set Channel
status = ps5000SetChannel(m_handle,
PS5000_CHANNEL_A,
true, // enable
false, //channel coupling
PS5000_500MV
);
if (status != PICO_OK)
{
cout << "Unable to set Channel" << endl;
cout << "Error code:" << status << endl;
}
else cout << "Channel set" << endl;
// Set MemorySegments
int nMaxSamples;
status = ps5000MemorySegments(m_handle, nSegments, &nMaxSamples);
if (status != PICO_OK)
{
cout << "Unable to set Memory Segments" << endl;
cout << "Error code:" << status << endl;
}
else cout << "Memory Segments set to " << nSegments << ". Max Samples per capture " << nMaxSamples << endl;
// Set no of captures
status = ps5000SetNoOfCaptures(m_handle, nNoOfCaptures);
if (status != PICO_OK)
{
cout << "Unable to set noOfCaptures. " << "Error code:" << status << endl;
}
else cout << "Number of Captures set to " << nNoOfCaptures << endl;
// Start the scope
int timeIndisposedMs;
status = ps5000RunBlock(m_handle,
0, // no of pre trigger samples
noOfWantedSamples, // no of post trigger samples
4, // timebase
0, // Oversample
&timeIndisposedMs,
0, // segment index
//&callback_scopeReady, //callback function
NULL,
NULL);
if (status != PICO_OK)
{
cout << "Unable to runBlock" << endl;
cout << "Error code :" << status << endl;
}
else cout << "runBlock worked!";
// Wait for scope to finish capture
short rdy = 0;
while(rdy == 0){
ps5000IsReady(m_handle, &rdy);
}
cout << "Scope rdy" << endl;
// Set the databuffers
status = ps5000SetDataBufferBulk(m_handle,
PS5000_CHANNEL_A,
traceBuffer,
noOfWantedSamples, // Buffersize
0 // Waveform
);
if (status != PICO_OK) cout << "Unable to set databuffer." << "Error code :" << status<< endl;
else cout << "ps_setDataBufferBulk worked" << endl;
// Receive the data
short overflow[1];
status = ps5000GetValuesBulk(m_handle,
&noOfWantedSamples,
0,
0,
overflow
);
if (status != PICO_OK) cout << "GetValuesBulk failed." << "Error code:" << status << endl;
else cout << "ps_getValuesBulk worked" << endl;
// Print buffer
for(int i = 0; i