AxsunOCTControl_LW 1.6.0
A light-weight & cross-platform alternative to the .NET-based AxsunOCTControl.dll.
AxsunOCTControl_LW_Python_example.py

This example source code and the aoclw_wrapper.py wrapper file show how to integrate the AxsunOCTControl_LW API in a Python client application via the ctypes library (https://docs.python.org/3/library/ctypes.html).

1
2import sys, time
3from ctypes import cast, py_object
4from aoclw_wrapper import AOCLW_wrapper_class, AxErr
5
6
7def ConnectCallbackFunction(userdata):
8 obj = cast(userdata, py_object).value
9 count = obj.CountDevices()
10 print("Devices connected: " + str(count))
11 for i in range(0, count):
12 print(str(i) + ") "
13 + obj.GetDeviceType(i) + "\t"
14 + obj.GetSerialNum(i) + "\tFW: "
15 + obj.GetFirmwareVersion(i) + "\tvia "
16 + obj.GetConnectionType(i))
17
18
19try:
20 axsun_control = AOCLW_wrapper_class(0)
21 print("Loaded AxsunOCTControl_LW version: " + axsun_control.LibraryVersion())
22
23 axsun_control.RegisterCallback(ConnectCallbackFunction, axsun_control)
24
25 axsun_control.OpenUSBInterface(1)
26
27 time.sleep(1)
28 print("\nWhen DAQ is connected, press ENTER to continue... \n")
29 input() # wait for user input
30
31 axsun_control.SetFPGARegister(60, 42, 0) # set a register (60) to a value (42)
32 print(str(axsun_control.GetFPGARegister(60, 0))) # read back register (60) and print to verify value was written
33 axsun_control.SetFPGARegister(60, 0, 0) # set a register (60) to a value (0)
34 print(str(axsun_control.GetFPGARegister(60, 0))) # read back register (60) and print to verify value was written
35
36 # add as many register reads/writes as needed here
37 # ...
38 # ...
39
40except AxErr as error:
41 print(error)
42
43