How to use fuction ps6000SetTriggerChannelConditions in python

Post discussions on applications you are writing
Post Reply
zqh0053
Newbie
Posts: 0
Joined: Sat Nov 09, 2019 2:27 am

How to use fuction ps6000SetTriggerChannelConditions in python

Post by zqh0053 » Thu Nov 14, 2019 8:34 am

Hi!
I'm a new user of picoscope, and I got my 6404d last month.
I want to use python to build my application, and I need help.
I can set a simple trigger with this function, ps6000SetSimpleTrigger().
But I don't know how to use function ps6000SetTriggerChannelConditions().I have built the struct like this

Code: Select all

class trigger_conditions(ctypes.Structure):
    """ creates a struct to match PS6000_TRIGGER_CONDITIONS"""
    _pack_ = 1
    _fields_ = [('channelA', ctypes.c_int8),
                ('channelB', ctypes.c_int8),
                ('channelC', ctypes.c_int8),
                ('channelD', ctypes.c_int8),
                ('external', ctypes.c_int8),
                ('aux', ctypes.c_int8),
                ('pulseWidthQualifier', ctypes.c_int8)]
then I use this

Code: Select all

conditions = trigger_conditions(1, 0, 1, 0, 0, 0, 0)

status["triggerconditions"] = ps.ps6000SetTriggerChannelConditions(chandle, ctypes.byref(conditions), 1)
assert_pico_ok(status["triggerconditions"])
but it shows error

Code: Select all

Traceback (most recent call last):
  File "E:/python/picoscope/test01/test02.py", line 84, in 
    assert_pico_ok(status["triggerconditions"])
  File "C:\Users\lenovo\AppData\Local\Programs\Python\Python37\lib\site-packages\picosdk\functions.py", line 133, in assert_pico_ok
    raise PicoSDKCtypesError("PicoSDK returned '{}'".format(PICO_STATUS_LOOKUP[status]))
picosdk.errors.PicoSDKCtypesError: PicoSDK returned 'PICO_CONDITIONS'
So how to use this function? Is there anyone can provide some examples?

Thanks

Post Reply