This tutorial shows how Python scripts can be used with the Opto Memory-Mapped Protocol (OptoMMP) to read and write data to Opto 22 memory-mapped devices for simple, powerful I/O control.
- A groov EPIC processor with SSH access
- Programming experience (Python recommended)
- Experience with hexadecimal values and memory addressing is helpful
OptoMMP is a memory-mapped protocol based on the IEEE 1394 standard that is used to create custom software applications for remote monitoring, industrial control, and data acquisition. For a list of compatible hardware, see the OptoMMP Protocol Guide (form 1465).
Since Python is so high-level it is missing a few bit- and byte-sized memory manipulation tools, which can make packing and unpacking data somewhat convoluted. This tutorial relies on Python’s socket interface to send and receive data, and I’ll be managing that data using:
- Built-in arrays to hold the data
- Built-in bytearray to encode the data
- Imported struct library to help translate
It is helpful to be familiar with these tools but their basic usage will be covered in this tutorial.
TIP: To keep Python scripts dynamic, pass in arguments at runtime rather than hard-coding them; simply reference these values with
sys.argv[#] to get the
#th argument value, where the script name is held in
Continue with Building an OptoMMP Data Package.