The past few days, I’ve been working with Paul to write a C++ program to communication with the Aura Lumencor Light Engine via the computer’s RS-232 port. Warren provided a COMMDRV library (http://www.wcscnet.com/), which includes functions for RS-232 communication. The most critical functions for the project were ‘PutByte’ (which allows for the transfer of a single character), ‘OpenComPort’, ‘SetPortCharacteristics’ (to set baud rate, parity, stop bits and communication protocol) and ‘CloseComPort’. Since the Lumencor specification (http://www.lumencor.com/downloads/Aura%20TTL%20IF%20Doc.pdf) expresses byte sequences in hexadecimal, we used ‘PutByte’ to pass unsigned char’s represented as hex (e.g. unsigned char byte1 = 0xff). One issue that we ran into was that the program processed all the bytes and terminated much more quickly than the serial port could pass the data to the Light Engine. This led to the truncation of many of the commands. In order to correct for this, we added ‘Sleep’ commands so that the program would wait long enough to allow data transfer.
A few notes on the COMMDRV library. In order to use the library functions, the cdrvhf32.lib and cdrvxf32.lib files must be included in the program. In addition, <comm.h> must be included and ‘MSWIN’, ‘MSWIN32’ and ‘MSWINDLL’ must be defined. The omission or incorrect placement of these declarations may lead to link errors; try to include them as early as possible in the program.
One very useful tool for debugging RS-232 communication is a terminal emulator such as Hyperterminal or Realterm; I preferred the layout of the latter. By connecting two COM ports (whether on different computers or on the same computer) via a NULL MODEM cable, you can pass bytes and check to see how they are received on the other end; the NULL MODEM cable serves to cross the transmit and receive pins of the two RS-232 cables (so that receive(COM1) à transmit(COM2) and transmit(COM1)àreceive(COM2)). Note: NULL MODEM cables have the same pin structure as RS-232 cables and can come in various male / female configurations. Be sure to look for the NULL MODEM label!
In order to create short hex files containing Lumencor commands, I used the HxD hex editor. The hex files could be dumped to the COM port using RealTerm.