54
M3i.48xx / M3i.48xx-exp Manual
Python Programming Interface and Examples
Software
file regs.py
The regs.py file defines all constants that are used for the driver. The constant names are the same names compared to the C/C++ examples.
All constant names will be found throughout this hardware manual when certain aspects of the driver usage are explained. It is recommended
to only use these constant names for better readability of the programs:
file spcerr.py
The spcerr.py file contains all error codes that may be returned by the driver.
Examples
Examples for Python can be found on CD in the directory /examples/python. The directory contains the above mentioned header files and
a some examples, each of them working with a certain type of card. Please feel free to use these examples as a base for your programs and
to modify them in any kind.
When allocating the buffer for DMA transfers, use the following function to get a mutable character buffer:
ctypes.create_string_buffer(init_or_size[, size])
SPC_M2CMD = 100l # write a command
M2CMD_CARD_RESET = 0x00000001l # hardware reset
M2CMD_CARD_WRITESETUP = 0x00000002l # write setup only
M2CMD_CARD_START = 0x00000004l # start of card (including writesetup)
M2CMD_CARD_ENABLETRIGGER = 0x00000008l # enable trigger engine
...