OpenDRO can interface with a PC for automating its operation and reporting information. The PC interface works over both the USB port and the RS-232 port. When connected over the USB port, the DRO appears to the PC as a virtual COM port. A Windows INF file is available at OpenDRO sourceforge site to install the proper driver for the virtual COM port. Both the USB and RS-232 interfaces use a baud rate of 57600 and communication parameters at 8-N-1. You can use Windows HyperTerminal, TeraTerm, or any other serial communication software to enter commands.
The OpenDRO automation interface uses the Lua programming language. Lua is a lightweight and simple scripting language that is commonly embedded into larger applications due to the ease of integration of its C API. The language is easy to learn and very flexible. The rest of this document will assume some minimal knowledge of Lua so if this is your first exposure to it, I would suggest looking at the on-line books Programming in Lua and the Lua Reference Manual.
In addition to the core language operators, Lua defines a set of standard libraries that incorporates commonly used functionality, a list of the standard libraries available in OpenDRO are shown below. Reference the Lua documentation for exact usage and syntax.
The Lua source code in OpenDRO incorporates two important patches to Lua that conserve memory in OpenDRO, the LTR patch and the EGC patch. The LTR (Lua Tiny RAM) patch saves memory by making most standard Lua tables read-only so they can be store in Flash rather than RAM. The EGC (Emergency Garbage Collector) is a patch that aggressively frees memory with the garbage collector when memory is low. These patches are important because RAM is very scarce in OpenDRO due to the limited amounts in the Atmel ARM7 processors (32KB in the DRO-550 and 64KB in the DPU-550).
One should be realistic with the capabilities of the automation interface due to the small amounts of free RAM available. The interface is designed to write simple scripts to assist the machinist with common tasks or to customize the behavior of the DRO. It is not designed to write large blocks of functionality. That is much more efficient and compact if it is written in C and added to the main OpenDRO source code. The examples below will demonstrate some techniques to minimize memory usage when using the automation interface such as loading scripts from the SD card and setting variables to nil when they are no longer needed.