35.3.1 DMX Controller
The DMX Controller mode is configured with the following settings:
- MODE = 1010
- TXEN = 1
- RXEN = 0
- TXPOL = 0
- UxP1 = one less than the number of bytes to transmit (excluding the Start code)
- UxBRG = value to achieve 250K baud rate
- STP = 10 for two Stop bits
- RxyPPS = TX pin output code
- ON = 1
Each DMX transmission begins with a Break followed by a byte called the “Start Code”. The width of the Break is fixed at 25 bit times. The Break is followed by a “Mark After Break” (MAB) Idle period. After this Idle period, the first through the ‘n’th byte is transmitted, where ‘n-1’ is the value in UxP1. See the following figure.
Software sends the Start Code and the ‘n’ data bytes by writing the UxTXB register with each byte to be sent in the desired order. A UxTXIF value of ‘1’ indicates when the UxTXB is ready to accept the next byte.
The internal byte counter is not accessible to software. Software needs to keep track of the number of bytes written to UxTXB to ensure that no more and no less than ‘n’ bytes are sent because the DMX state machine will automatically insert a Break and reset its internal counter after ‘n’ bytes are written. One way to ensure synchronization between hardware and software is to toggle TXEN after the last byte of the universe is completely free of the transmit shift register, as indicated by the TXMTIF bit.