ps2000aGetUnitInfo on python - sample?

Post general discussions on using our drivers to write your own software here
Post Reply
KTH
Newbie
Posts: 0
Joined: Mon Mar 09, 2020 10:27 am

ps2000aGetUnitInfo on python - sample?

Post by KTH »

I use the picoscop 2206B. The python wrapper from "https://github.com/picotech/picosdk-python-wrappers" is running and I basically get data with Python 3.8

"from picosdk.discover import find_all_units" i got
Typ : 2206B
SerialNo.: HT431/0011
Used Lib.: picosdk ps2000a library

I'm also able to get data from the device.

But how to run "ps2000aGetUnitInfo". Is there any python sample for this?
How to get details from "PICO_INFO"?

KTH
Newbie
Posts: 0
Joined: Mon Mar 09, 2020 10:27 am

Re: ps2000aGetUnitInfo on python - sample?

Post by KTH »

After some search and couple of tries, I found a way to get the "ps2000aGetUnitInfo" running on python. To solve this, the sample code in Visual Basic [1] and details on the PicoScope 2000 Series (A API) guide [2] was helpful. For more Infos see [2] page 41 - ps2000aGetUnitInfo() - get information about
scope device.

Code: Select all

def devDetailInfo (i):
    switcher={
        0:'PICO_DRIVER_VERSION            : ',
        1:'PICO_USB_VERSION               : ',
        2:'PICO_HARDWARE_VERSION          : ',
        3:'PICO_VARIANT_INFO              : ',
        4:'PICO_BATCH_AND_SERIAL          : ',
        5:'PICO_CAL_DATE                  : ',
        6:'PICO_KERNEL_VERSION            : ',
        7:'PICO_DIGITAL_HARDWARE_VERSION  : ',
        8:'PICO_ANALOGUE_HARDWARE_VERSION : ',
        9:'PICO_FIRMWARE_VERSION_1        : ',
        10:'PICO_FIRMWARE_VERSION_2       : '
        }
    return switcher.get(i,"Invalid Param")

devInfo_buffer = (ctypes.c_int16*2)()
p_devInfo_buffer = ctypes.cast(devInfo_buffer, ctypes.POINTER(ctypes.c_int16*2))

for ii in range(11):
    devString = b"                "
    status["getUnitInfo"] = ps.ps2000aGetUnitInfo(
        chandle,
        ctypes.c_char_p(devString),
        len(devString),
        p_devInfo_buffer,
        ii
        )
    assert_pico_ok(status["getUnitInfo"])
    print(str(ii) + " - " + devDetailInfo(ii) + devString.decode('utf-8'))
[1] https://github.com/picotech/picosdk-vb- ... ckVBCon.vb
[2] https://www.picotech.com/download/manua ... -guide.pdf

Post Reply