using 2 PS6824E with python

Post general discussions on using our drivers to write your own software here
Post Reply
markusfa
Newbie
Posts: 0
Joined: Tue Aug 24, 2021 9:11 am

using 2 PS6824E with python

Post by markusfa »

Hi,

I will use 2 PS6824E and control it with python.
problem is, I don´t have success with
"ps6000aGetUnitInfo"
There is alwas message returned:
Exception has occurred: ArgumentError
argument 2: : wrong type
File "C:\xxx\xxx\xxx\xxx\xxx\PS6824E.py", line 80, in
status["getInfo"] = ps.ps6000aGetUnitInfo(chandle, ctypes.byref(string), stringLength, ctypes.byref(requiredSize), PSINFO)
code:
# Get Info from scope
string = (ctypes.c_char * 40)()
stringLength = ctypes.c_int16(40)
requiredSize = ctypes.c_int16()

# info Example
# 0 PICO_DRIVER_VERSION - Version number of ps6000a DLL
# 1 PICO_USB_VERSION - Type of USB connection to device
# 2 PICO_HARDWARE_VERSION - Hardware version of device
# 3 PICO_VARIANT_INFO - Model number of device
# 4 PICO_BATCH_AND_SERIAL - Batch and serial number of device
# 5 PICO_CAL_DATE - Calibration date of device
# 6 PICO_KERNEL_VERSION - Version of kernel driver
# 7 PICO_DIGITAL_HARDWARE_VERSION - Hardware version of the digital section 1
# 8 PICO_ANALOGUE_HARDWARE_VERSION - Hardware version of the analog section 1
# 9 PICO_FIRMWARE_VERSION_1 - Version information of Firmware
# A PICO_FIRMWARE_VERSION_2 - Version information of Firmware

PSINFO = ps0.PICO_INFO["PICO_VARIANT_INFO"]
print(PSINFO)

status["getInfo"] = ps.ps6000aGetUnitInfo(chandle, ctypes.byref(string), stringLength, ctypes.byref(requiredSize), PSINFO)
assert_pico_ok(status["getInfo"])

print(string.value)

When I try lib ps6000 there is no error warning for wrong type!
But with wrong driver result is no device found!
Thats ok.

PS6000a examples are working fine!
Can anyone help where is the bug?

Any other ways to have defined controlled access to two picoscopes on one PC?

thanks
Markus

doug.kelly
Newbie
Posts: 0
Joined: Tue Sep 26, 2023 7:41 pm

Re: using 2 PS6824E with python

Post by doug.kelly »

In case anyone ends up here looking for a solution, I ended up having to do some aggressive casting to modify the ps6000 case for use with ps6000a.

Not pretty, but it works:

Code: Select all

    def get_serial_number(self) -> str:
        """Returns SN from scope"""
        info_string = (ctypes.c_char * 40)()
        info_string_arg = ctypes.cast(ctypes.byref(info_string), ctypes.c_char_p)
        string_length = ctypes.c_int16(40)
        required_size = ctypes.c_int16(40)
        required_size_arg = ctypes.cast(ctypes.byref(required_size), ctypes.c_void_p)
        info = self.sdk.PICO_INFO["PICO_BATCH_AND_SERIAL"]
        info_arg = ctypes.c_long(info)
        status = self.sdk.ps6000aGetUnitInfo(
            self.handle,
            info_string_arg,
            string_length,
            required_size_arg,
            info_arg,
        )
        self.functions.assert_pico_ok(status)
        return info_string.value.decode("utf-8")

Post Reply