PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
private void button_openunit_Click(object sender, EventArgs e)
{
bool pico_enable = true;
short _handle = 0;
short[] _buffers;
uint _timebase = 5;
uint sampleCount;
short status;
Imports.DeviceResolution resolution = Imports.DeviceResolution.PS5000A_DR_8BIT;
short handle;
status = Imports.OpenUnit(out handle, null, resolution);
System.Console.WriteLine("OpenUnit status: " + status.ToString());
if (handle > 0)
{
_handle = handle;
status = Imports.ChangePowerSource(_handle, (short)Imports.PICO_POWER_SUPPLY_NOT_CONNECTED);
System.Console.WriteLine("ChangePowerSource status: " + status.ToString());
}
else
{
System.Console.WriteLine("handle: " + handle.ToString());
pico_enable = false;
}
if (pico_enable == false) return;
status = Imports.SetChannel(_handle, Imports.Channel.ChannelA, 1, 1, Imports.Range.Range_5V, 0);
status = Imports.SetChannel(_handle, Imports.Channel.ChannelB, 1, 1, Imports.Range.Range_200mV, 0);
System.Console.WriteLine("SetChannel status: " + status.ToString());
// Set trigger
short enable = 1;
short threshold = 5000;
uint delay = 0;
status = Imports.SetSimpleTrigger(_handle, enable, Imports.Channel.ChannelA, threshold, Imports.ThresholdDirection.Rising, delay, 0);
System.Console.WriteLine("SetSimpleTrigger status: " + status.ToString());
_callbackDelegate = BlockCallback;
// Set data buffer
sampleCount = 1000;
_buffers = new short[sampleCount];
status = Imports.SetDataBuffer(_handle, Imports.Channel.ChannelA, _buffers, (int)sampleCount, 0, Imports.RatioMode.None);
System.Console.WriteLine("SetDataBuffer status: " + status.ToString());
// Get time base
float timeInterval;
int maxSamples;
while (Imports.GetTimebase2(_handle, _timebase, (int)sampleCount, out timeInterval, out maxSamples, 0) != 0)
{
_timebase++;
System.Console.WriteLine("GetTimeBase2 status: " + status.ToString());
}
_ready = false;
int timeIndisposed;
status = Imports.RunBlock(_handle, 100, (int)sampleCount - 100, _timebase, out timeIndisposed, 0, _callbackDelegate, IntPtr.Zero);
System.Console.WriteLine("RunBlock status: " + status.ToString());
}
Code: Select all
uint status;
Imports.DeviceResolution resolution = Imports.DeviceResolution.PS5000A_DR_8BIT;
short handle;
status = Imports.OpenUnit(out handle, null, resolution);
System.Console.WriteLine("OpenUnit status: " + status.ToString());
if (handle > 0)
{
_handle = handle;
status = Imports.ChangePowerSource(_handle, Imports.PICO_POWER_SUPPLY_NOT_CONNECTED);
System.Console.WriteLine("ChangePowerSource status: " + status.ToString());
}
else
{
System.Console.WriteLine("handle: " + handle.ToString());
pico_enable = false;
}