Protocol: Packet format: ------------------------------------------------------- | Count | Destination | Data | ............... | Data | | Word | Word | Byte | ............... | Byte | ------------------------------------------------------- Count is the size of the data in the packet. Destination is a 16-bit field that routes the data to follow. The values 0-512 in this field are special. They signify a DMX channel, and are auto-incremented as the data comes in. Data is self explanitory. List of destinations: 0x0000 - 0x0200: DMX Channels. This address range will automatically increment with each data byte. Command format to do a complete DMX refresh: 0x02 0x00 0x00 0x01 Command format to write 10 values starting with channel number 403: 0x00 0x0A 0x01 0x93 0x0201: Read bytes from DMX_Array. Length is 4 bytes: Bytes Hi, Bytes Lo, Address Hi, Address Lo. Command format to read entire DMX frame (although there is a command for this): 0x00 0x04 0x02 0x01 0x02 0x00 0x00 0x01 Adapter will return 512 bytes of DMX data beginning with the first channel (Channel 1). Command format to read 65 bytes of DMX data beginning with channel 267: 0x00 0x04 0x02 0x01 0x00 0x41 0x01 0x0B Adapter will return 65 bytes of DMX data beginning with channel 267. 0x0202: Alter ADC/Channel binding. (Write Only) Length is 3 bytes: Channel #, Address Hi, Address Lo. 0x0203: Read ADC Port. Length is 1 byte. Channel #. 0x0204: Set delay between frames. 0x0205: Get delay between frames. 0x0206: Dump whole DMX_Array. Command format: 0x00 0x00 0x02 0x06 At which point the adapter will return 513 bytes that represent the DMX array. The first byte should read zero. This is a nuance of the DMX512 protocol. DMX byte zero is never sent to the DMX chain. 0x0207: Return all eight ADC values. Command format: 0x00 0x00 0x02 0x07 At which point the adapter will return 8 bytes that are the values of ADC channels 0-7. 0x0208: Reset Adapter. 0x0209: Flash adapter firmware. 0x020A: Write adapter's configuration register. 0x020B: Read adapter's configuration register. 0x020C: Read adapter's status register. 0x020D: Write DMX chain length. Valid values are between (and including) 24 and 512. 0x020E: Read DMX chain length. Adapter will return two bytes. This will be the number of DMX channels being actively refreshed. 0xFFFF: Re-sync command stream. Use this in case the adapter doesn't respond the way it ought to to a given command. If this happens, it is almost certainly a bug on the PC's part. The format of this command should be: 0xFF 0xFF 0xFF 0xFF 0xFF ...... Until the adapter begins to echo. Size = 65535 bytes, command 0xFFFF As soon as the command stream has been re-sync'd, the adapter will echo each 0xFF sent to it for an indefinite count of 0xFF bytes. As soon as this begins to happen, the stream can be considered re-sync'd and a different command may be issued. I recommend that the completion of this command should ALWAYS be followed by an adapter reset command, unless the PC programmer can be reasonably assured that the state of the adapter is known. Be careful, because this is not always easy to be sure of. To be safe, a reset should be issued. An alternate use of this command is as an echo/ping command. If there is nothing wrong with the sync of the command stream (a valid assumption if the PC program follows spec), this command can be continually issued until the adapter begins to return it. This mechanism is useful for determining the presence of the hardware. If the stream is in sync, the adapter will echo back the fifth byte and all 0xFF bytes thereafter until a byte other than 0xFF is sent. 0x21: Write 8-bit status register. 0x22: Read 8-bit config register. 0x23: Read DMX512 chain length. Default (and recomended) value is 512. Adapter returns 2 bytes. 0xFC: Set autonomous mode. Any non-zero value causes the adapter to wait on the host before each DMX refresh. The adapter will send the host the value 0xFF at the end of each DMX refresh to signify that it needs a new frame. This mode is the real-time host control mode in its purist form. If this value is written as a zero, the adapter will continually refresh the DMX chain based on the hosts last given dataset. 0xFF: Set length of DMX512 chain. Legal sizes are 24 to 512.