PicoScope 7 Software
Available on Windows, Mac and Linux
Code: Select all
public enum PS5000A_CONDITIONS_INFO : uint
{
PS5000A_CLEAR,
PS5000A_ADD
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct tPS5000ATriggerChannelPropertiesV2
{
public short thresholdUpper;
public ushort hysteresisUpper;
public short thresholdLower;
public ushort hysteresisLower;
public Channel Channel;
public tPS5000ATriggerChannelPropertiesV2(
short thresholdUpper,
ushort hysteresisUpper,
short thresholdLower,
ushort hysteresisLower,
Channel channel)
{
this.thresholdUpper = thresholdUpper;
this.hysteresisUpper = hysteresisUpper;
this.thresholdLower = thresholdLower;
this.hysteresisLower = hysteresisLower;
this.Channel = channel;
}
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct tPS5000ADirection
{
public Channel channel;
public ThresholdDirection direction;
public ThresholdMode mode;
public tPS5000ADirection(
Channel channel,
ThresholdDirection direction,
ThresholdMode mode)
{
this.channel = channel;
this.direction = direction;
this.mode = mode;
}
}
[DllImport(_DRIVER_FILENAME, EntryPoint = "ps5000aSetTriggerChannelPropertiesV2")]
public static extern uint SetTriggerChannelPropertiesV2(
short handle,
tPS5000ATriggerChannelPropertiesV2[] channelProperties,
short nChannelProperties,
short auxOutputEnable);
[DllImport(_DRIVER_FILENAME, EntryPoint = "ps5000aSetTriggerChannelConditionsV2")]
public static extern uint SetTriggerChannelConditionsV2(
short handle,
tPS5000ACondition[] conditions,
short nConditions,
PS5000A_CONDITIONS_INFO info);
[DllImport(_DRIVER_FILENAME, EntryPoint = "ps5000aSetTriggerChannelDirectionsV2")]
public static extern uint SetTriggerChannelDirectionsV2(
short handle,
tPS5000ADirection[] directions,
short nDirections);
Code: Select all
Imports.tPS5000ATriggerChannelPropertiesV2[] properties = new Imports.tPS5000ATriggerChannelPropertiesV2[1];
Imports.ThresholdDirection.Rising, delay, auto);
properties[0].thresholdLower = 25000;
properties[0].thresholdUpper = 25000;
properties[0].hysteresisLower = 100;
properties[0].hysteresisUpper = 100;
properties[0].Channel = Imports.Channel.ChannelA;
Imports.tPS5000ACondition[] conditions = new Imports.tPS5000ACondition[1];
conditions[0].source = Imports.Channel.ChannelA;
conditions[0].condition = Imports.TriggerState.True;
Imports.tPS5000ADirection[] directions = new Imports.tPS5000ADirection[1];
directions[0].channel = Imports.Channel.ChannelA;
directions[0].direction = Imports.ThresholdDirection.Above;
directions[0].mode = Imports.ThresholdMode.Level;
status = Imports.SetTriggerChannelConditionsV2(_handle, conditions, 1, Imports.PS5000A_CONDITIONS_INFO.PS5000A_CLEAR); //Returns 300.
status = Imports.SetTriggerChannelPropertiesV2(_handle, properties, 1, 1); //Returns 382
status = Imports.SetTriggerChannelConditionsV2(_handle, conditions, 1, Imports.PS5000A_CONDITIONS_INFO.PS5000A_ADD); //Returns 0
status = Imports.SetTriggerChannelDirectionsV2(_handle, directions, 1); //Returns 0
status = Imports.SetAutoTriggerMicroSeconds(_handle, 0); //Returns 0