PicoScope 7 Software
Available on Windows, Mac and Linux
Firstly, the UsbAdc11OpenUnit() function returns a handle not a boolean. The handle will be zero if nothing is connected.[DllImport("usbadc11.dll")]
public static extern Boolean UsbAdc11OpenUnit();
why should this code always return true even if the Usb adc11 is not connected.
Code: Select all
public struct BOOL
{
private short _boolean;
public static implicit operator bool(BOOL from)
{
return Convert.ToBoolean(from._boolean);
}
}
You have a later version of the dll![DllImport("ADC1132.dll")]
public static extern short adc11_get_driver_version ();
...
returns 1026 instead of 1023 is stated in the SDK, any explanation for this?
You have an incorrect declaration, try:public static extern uint UsbAdc11MaxValue(short handle, ref uint maxium );
[DllImport("usbadc11.dll")]
give outrageous value 1179648 instead of 1023 or 4095
how can i also collect data without using the trigger fuction as stated by the routines.
Code: Select all
[DllImport("usbadc11.dll")]
public static extern short UsbAdc11OpenUnit();
[DllImport("usbadc11.dll")]
public static extern BOOL UsbAdc11MaxValue(short handle, out ushort max);
...
short handle = USBADC11.UsbAdc11OpenUnit();
if(handle > 0)
{
// Q3
ushort maxValue;
BOOL success = USBADC11.UsbAdc11MaxValue(handle, out maxValue);
Console.Out.WriteLine(success ? string.Format("maxValue = {0}", maxValue) : "error");
}
How can is use this in my C# programming while usiong the
InteropServices service for each.
Code: Select all
public enum enAdc11Info
{
USBADC11_DRIVER_VERSION,
USBADC11_USB_VERSION,
USBADC11_HARDWARE_VERSION,
USBADC11_VARIANT_INFO,
USBADC11_BATCH_AND_SERIAL,
USBADC11_CAL_DATE,
USBADC11_KERNEL_DRIVER_VERSION,
USBADC11_ERROR,
USBADC11_SETTINGS,
}
[DllImport("usbadc11.dll")]
public static extern BOOL UsbAdc11GetUnitInfo(short handle, StringBuilder str, short stringLength, enAdc11Info info);
...
StringBuilder sb = new StringBuilder(100);
success = USBADC11.UsbAdc11GetUnitInfo(handle, sb, 100, USBADC11.enAdc11Info.USBADC11_BATCH_AND_SERIAL);
Console.Out.WriteLine(success ? string.Format("info = {0}", sb) : "error");
USBADC11.UsbAdc11CloseUnit(handle);