PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
#include "pico_scope.h"
PicoScope::PicoScope(QObject *parent) :
QObject(parent)
{
}
int32_t PicoScope::openScope()
{
short status;
long time_interval;
short time_units;
long max_sample;
long time_indisposed_ms;
psHandler = ps3000_open_unit();
if (psHandler <= 0)
return(PS_OPEN_FAILED);
status = ps3000_set_channel(psHandler, PS3000_CHANNEL_A, TRUE, TRUE, PS3000_100MV);
if (status != 1)
return(PS_SET_CHANNEL_FAILED);
status = ps3000_set_trigger(psHandler, PS3000_NONE, 16400, PS3000_RISING, 0, 0);
if (status != 1)
return(PS_SET_TRIGGER_FAILED);
status = ps3000_get_timebase(psHandler, 1, 1000, &time_interval, &time_units, 1, &max_sample);
if (status != 1)
return(PS_GET_TIMEBASE_FAILED);
status = ps3000_run_block(psHandler, 1000, 1, 1, &time_indisposed_ms);
if (status != 1)
return(PS_RUN_BLOCK_FAILED);
return (PS_NO_ERROR);
}
int32_t PicoScope::ReadScope()
{
short status;
short buffer_a[1000];
short overflow;
status = ps3000_ready(psHandler);
if (status != 1)
return(PS_READY_FAILED);
status = ps3000_get_values(psHandler, &buffer_a[0], 0, 0, 0, &overflow, 1000);
if (status == 0)
return(PS_GET_VALUES_FAILED);
qDebug()<<"Values from Channel a0 : "<< buffer_a[0];
status = ps3000_stop(psHandler);
if (status != 1)
return(PS_STOP_FAILED);
return (PS_NO_ERROR);
}
Code: Select all
ps3000_set_channel(psHandler, PS3000_CHANNEL_A, TRUE, TRUE, PS3000_100MV)
Code: Select all
( adc_count * input_range ) / 32767