Final Steps: Python interfacing with C328A

Final Steps: Python interfacing with C328A, a forum discussion on Cleverscope Mixed Signal USB Oscilloscopes. Join us for more discussions on Final Steps: Python interfacing with C328A on our Driver Questions forum.

Back to Forum Index : Back to Driver Questions   RSS

2 Aug 2019
Posts: 1

Hello Clever people,

Software development packages discussed here:
Cleverscope DLL version 2.8
Python 3.7.3
Ctypes 1.1.0

I have a Python application with a nice UI which interfaces with two function generators and a Tektronix oscilloscope. I would like to replace the Tektronix scope in favor of a Cleverscope 328A for an improvement in data collection and transfer speed without having to rebuild my application in C++, where I am not as capable.

I am currently working on a Python script to interface between Python and the Cleverscope, utilizing the ctypes package for pointer capability and to parse the DLL's functions (ctypes.windll for functions which use the stdcall convention (all but LVDLLStatus), and ctypes.cdll for functions which use the cdecl convention (LVDLLStatus)).

Below is a list of some of the functions I have achieved in communicating with the C328A over USB, using MATLAB and C++ examples as guidance:

- Recreated the TD1 and TD2 C++ structures or classes (terminology isn’t my strong suit) described in the Cscope Control Driver header (.h) file
- Confirmed that ctypes’ pointers allow the device to access and edit the values of variables, such as CAUStatus and errorOut.code, which would imply that it could also edit my pre-allocated arrays waiting for data
- Initialized CAU connections (command = 0)
- Updated the acquire definition (command = 4)
- Updated CAUStatus (command = 6)
- Detected triggers live (AcquireMode = 2, normal triggering mode, manually connecting and disconnecting a AA battery)

Recently, I have hit a roadblock: I am having trouble getting any non-zero data from the device. I am following the latest DLL documentation (page 7/33).

Initialize (command = 0)
Confirm that the connection status is open (2) with (command = 6)
Set the parameters of an instance of the AcquireDefinition variable (start time = 0, stop time = 1 us, numSeqFrames = 1, NumBuffers = 2, AcquireMode = 1… etc. Easy parameters so that I don’t approach the operating limits of the device)
Feed that instance of the AcquireDefinition variable to the driver’s update function (command = 4)
Acquire (command = 1)
Until GotSamples’ value is nonzero, I wait 25 ms then I check for samples (command = 3).

I have never obtained a nonzero value in either channel’s returned data or after calling CscopeFunction for the maximum recorded value on either channel. I always get zeros. It was not easy to get Python talking to this device, and I would be happy to share my code upon receiving a response.

Thank you for any help you can provide.

With regards,
Back to Forum Index : Back to Driver Questions   RSS
You must be logged in to post a reply

You need to Register or Log In before posting on these forums.


Your shopping cart is empty.