SlideShare une entreprise Scribd logo
1  sur  26
DMX-512, Theatrical
Stage Lighting Protocol
Author: Parthiv Pandya
Agenda
• Introduction
• Anatomy of the Protocol
• Transmitter
• Receiver
• Test Setup
• Questions
DMX-512 9/30/2015 2
Introduction
• DMX-512A (Digital MultipleX), a communication protocol used
popularly for stage lighting
• Controls up to 512 separate channels/devices e.g. lighting fixtures
• Low cost and robust
• The standard is currently managed by the Entertainment Services &
Technology Association (ESTA)
DMX-512 9/30/2015 3
Background (Technology Evolution)
• Auto transformers
• Manual control
• Long wires
• Analog controllers with 0-10 V analog console.
• System was prone to noise
• Dimming could be non linear depending on lamps
• A separate control wire was required for each lamp
• Digital technology became cost effective
• Consoles required a new communication standard to allow different
manufacturers to use one standard
DMX-512 9/30/2015 4
Anatomy of the Protocol
9/30/2015DMX-512 5
Anatomy of the Protocol
• Unidirectional asynchronous serial transmission protocol with one
transmitter multiple receiver
• Data is transmitted at 250K baud rate using RS-485 transmission
standard over two wires and ground
• Transmitter is connected to a receiver using a 5-pin or 3-pin XLR
connector
• Protocol does not provide handshake between receiver and
transmitter or checking and correction mechanism
• So not used in safety critical application.
DMX-512 9/30/2015 6
XLR Pin Connectors
DMX-512 9/30/2015 7
XLR Pin Number DMX-512 Application Function
1 Common Common Reference
2 DMX Data -
Primary Data Link
3 DMX Data +
Timing Diagram and Timing Values
DMX-512
Description Minimum Maximum Typical Unit
Break 92 - 176 uSec
Mark after Break (MAB) 12 <1,000,000 - uSec
Bit Time 3.92 4.02 4 uSec
DMX512 Packets 1204 1,000,000 - uSec
9/30/2015 8
DMX-512 Transmitter
9/30/2015DMX-512 9
Transmitter
• Software solution employs a simple state machine
1. SENDMBB – DMX data line is Idle
2. SENDBREAK – DMX data line is driven low
3. SENDMAB – DMX data line is Idle
4. SENDDATA – Bytes 0 to 511 of the DMX frame
DMX-512 9/30/2015 10
Transmitter State Machine
DMX-512
SENDMBB
DmxTxState = 0
State 1
SENDDATA
DmxTxState = 3
State 4
SENDMAB
DmxTxState = 2
State 3
SENDBREAK
DmxTxState = 1
State 2
Wait for
100 uSec
Wait for
100 uSec
Wait for
100 uSec
After 100 uSec
After 100 uSec
512 bytes sent
After 100 uSec
9/30/2015 11
Generating Break Signal
• Break signal:
• Allows receivers to synchronize with the transmitter
• Identifies the beginning of a new packet of data
• EUSART module automatically generates a 12-bit long Break signal
• This corresponds to 48 μs at 250k baud.
• This is too short for use in a DMX512 application (min 92 uSec)
DMX-512 9/30/2015 12
Generating Break Signal (Cont.)
• A 100Ω resistor connected in series with the MCUs EUSART transmit
pin
• Other end of the resistor to an I/O pin, say RC5
• When sending a Break signal, pin RC5 is driven low. Later Pin RC5 is
tri-stated to allow the transmission from the EUSART to resume.
• Break time can be varied in software, from 92 μSec to 176 μSec to
meet the DMX protocol Break time specification
DMX-512 9/30/2015 13
Generating Break Signal (Cont.)
To RS-485
Transceiver
100 Ω
R
TX
RC5
DMX-512 9/30/2015 14
Sending the Dimming Data
• The dimming data is 8-bits wide
• ‘0’ represents a light off and ‘255’ represents full intensity
• EUSART is configured for 9-bit mode and 9th bit is set to ‘1’ to
generate two stop bits
DMX-512 9/30/2015 15
Transmitter Demo – Dimming a Lamp
DMX-512 9/30/2015 16
CCPR1
TMR 1
ADC
Comparator
UART
To RS-485
Transceiver
100 Ω
R
TX
RC5
RA0
Potentiometer
Transmitter Circuit Schematic
DMX-512 9/30/2015 17
DMX-512 Receiver
9/30/2015DMX-512 18
Receiver
DMX-512 9/30/2015 19
Receiver Application Demo
DMX-512 9/30/2015 20
CCPR2L
TMR 2
UART From RS-485
Transceiver
RX
Comparator
PWM
Receiver Circuit Schematic
DMX-512 9/30/2015 21
Test Setup
9/30/2015DMX-512 22
PICDEM 2 Plus Board
DMX-512 9/30/2015 23
Highlights:
• Supports 18, 28 and 40-pin 8-bit devices
• Prototype development area
• Integrated input/output
connectors and components
• Connectivity to all Microchip
Programmer/Debuggers/Emulators
PICDEM 2 Plus Board Features
9/30/2015DMX-512 24
32 x 8 Serial (I2C) EEPROM
9 V, 100 mA AC/DC Wall
Power Supply or 9V Battery LED
(Unpopulated) Canned and
Crystal Oscillator, RC Oscillator
Potentiometer
MSLR and Input Switches
User Access for
MCU Pins
User Prototype
Area
RS232 port
for UART
References
• PIC18F24J10 Data sheet (DS39682): The data sheet provides all the
necessary information regarding the EUSART module, CCP module,
ADC module and electrical characteristics of the PIC microcontroller.
• PICDEM™ 2 PLUS User’s Guide (DS51275): This application note has
been tested using a pair of PICDEM 2 PLUS demo boards.
• American National Standard E1.11 – 2004: The official DMX512
protocol specifications
DMX-512 9/30/2015 25
Thank You
9/30/2015DMX-512 26

Contenu connexe

Tendances

LoRaWAN Intro (Oct 2019)
LoRaWAN Intro (Oct 2019)LoRaWAN Intro (Oct 2019)
LoRaWAN Intro (Oct 2019)Alper Yegin
 
PlantPAx® System - What’s New & What’s Next
PlantPAx® System - What’s New & What’s NextPlantPAx® System - What’s New & What’s Next
PlantPAx® System - What’s New & What’s NextRockwell Automation
 
Fire, flame & smoke detectors
Fire, flame & smoke detectorsFire, flame & smoke detectors
Fire, flame & smoke detectorsAkaash Sahoo
 
Intelligent Street light monitoring system
Intelligent Street light monitoring systemIntelligent Street light monitoring system
Intelligent Street light monitoring systemvikas mantri
 
Home Automation Using IoT
Home Automation Using IoTHome Automation Using IoT
Home Automation Using IoTAshutosh Kumar
 
Fire alarm system and common types of detectors
Fire alarm system and common types of detectorsFire alarm system and common types of detectors
Fire alarm system and common types of detectorsMuhammad Farid
 
Android Based Home Automation Control
Android Based Home Automation ControlAndroid Based Home Automation Control
Android Based Home Automation ControlVivek Porwal
 
CCTV Camera Presentation
CCTV Camera PresentationCCTV Camera Presentation
CCTV Camera PresentationBasith JM
 
Different system of fire suppression
Different system of fire suppressionDifferent system of fire suppression
Different system of fire suppressionKamran Hassan
 
Smart home automation - Internet of Things
Smart home automation - Internet of ThingsSmart home automation - Internet of Things
Smart home automation - Internet of ThingsVinsol
 
Closed Circuit Television(CCTV)
Closed Circuit Television(CCTV)Closed Circuit Television(CCTV)
Closed Circuit Television(CCTV)Vaibhav Mudgal
 
Acoustic echo cancellation
Acoustic echo cancellationAcoustic echo cancellation
Acoustic echo cancellationchintanajoshi
 
Wireless Personal Area Networks
Wireless Personal Area NetworksWireless Personal Area Networks
Wireless Personal Area NetworksDilum Bandara
 

Tendances (20)

LoRaWAN Intro (Oct 2019)
LoRaWAN Intro (Oct 2019)LoRaWAN Intro (Oct 2019)
LoRaWAN Intro (Oct 2019)
 
PlantPAx® System - What’s New & What’s Next
PlantPAx® System - What’s New & What’s NextPlantPAx® System - What’s New & What’s Next
PlantPAx® System - What’s New & What’s Next
 
Fire, flame & smoke detectors
Fire, flame & smoke detectorsFire, flame & smoke detectors
Fire, flame & smoke detectors
 
KNX introduction
KNX introductionKNX introduction
KNX introduction
 
Intelligent Street light monitoring system
Intelligent Street light monitoring systemIntelligent Street light monitoring system
Intelligent Street light monitoring system
 
Home Automation Using IoT
Home Automation Using IoTHome Automation Using IoT
Home Automation Using IoT
 
Audio systems
Audio systemsAudio systems
Audio systems
 
Fire alarm system and common types of detectors
Fire alarm system and common types of detectorsFire alarm system and common types of detectors
Fire alarm system and common types of detectors
 
Basics of atex
Basics of atexBasics of atex
Basics of atex
 
Home Automation System
Home Automation SystemHome Automation System
Home Automation System
 
Android Based Home Automation Control
Android Based Home Automation ControlAndroid Based Home Automation Control
Android Based Home Automation Control
 
EPABX new
EPABX newEPABX new
EPABX new
 
CCTV Camera Presentation
CCTV Camera PresentationCCTV Camera Presentation
CCTV Camera Presentation
 
Different system of fire suppression
Different system of fire suppressionDifferent system of fire suppression
Different system of fire suppression
 
Smart home automation - Internet of Things
Smart home automation - Internet of ThingsSmart home automation - Internet of Things
Smart home automation - Internet of Things
 
Closed Circuit Television(CCTV)
Closed Circuit Television(CCTV)Closed Circuit Television(CCTV)
Closed Circuit Television(CCTV)
 
Software defined radio
Software defined radioSoftware defined radio
Software defined radio
 
Home automation using blynk
Home automation using blynkHome automation using blynk
Home automation using blynk
 
Acoustic echo cancellation
Acoustic echo cancellationAcoustic echo cancellation
Acoustic echo cancellation
 
Wireless Personal Area Networks
Wireless Personal Area NetworksWireless Personal Area Networks
Wireless Personal Area Networks
 

Similaire à DMX-512

Aspects Strategiques Des Réseaux 2008 2009
Aspects Strategiques Des Réseaux 2008 2009Aspects Strategiques Des Réseaux 2008 2009
Aspects Strategiques Des Réseaux 2008 2009Eric Vyncke
 
Driver Development for applications of networking services for a WAVE based d...
Driver Development for applications of networking services for a WAVE based d...Driver Development for applications of networking services for a WAVE based d...
Driver Development for applications of networking services for a WAVE based d...Janith Rukman
 
SELTA Access Network Portfolio
SELTA Access Network PortfolioSELTA Access Network Portfolio
SELTA Access Network PortfolioSELTA
 
Sspi day out_2014_teledyne-paul_sandoval
Sspi day out_2014_teledyne-paul_sandovalSspi day out_2014_teledyne-paul_sandoval
Sspi day out_2014_teledyne-paul_sandovalSSPI Brasil
 
IBC 2014 - Broadcast Presentation
IBC 2014 - Broadcast PresentationIBC 2014 - Broadcast Presentation
IBC 2014 - Broadcast PresentationNewtec
 
ความรู้เกี่ยวกับ MikroTik Nstreme Version 2 (Nv2)
ความรู้เกี่ยวกับ MikroTik Nstreme Version 2 (Nv2)ความรู้เกี่ยวกับ MikroTik Nstreme Version 2 (Nv2)
ความรู้เกี่ยวกับ MikroTik Nstreme Version 2 (Nv2)Tũi Wichets
 
Chap.1 ethernet introduction
Chap.1 ethernet introductionChap.1 ethernet introduction
Chap.1 ethernet introduction東原 李
 
SIEMENS PXG3.L BACnet/IP Router
SIEMENS PXG3.L BACnet/IP RouterSIEMENS PXG3.L BACnet/IP Router
SIEMENS PXG3.L BACnet/IP RouterCONTROLS & SYSTEMS
 
Accessing the Edge – with legacy communications and infrastructure
Accessing the Edge – with legacy communications and infrastructureAccessing the Edge – with legacy communications and infrastructure
Accessing the Edge – with legacy communications and infrastructureWestermo Network Technologies
 
Ccna day5-140715152501-phpapp01
Ccna day5-140715152501-phpapp01Ccna day5-140715152501-phpapp01
Ccna day5-140715152501-phpapp01Sachin Morya
 
Wireless agro automation system
Wireless agro automation systemWireless agro automation system
Wireless agro automation systemkarthikpunuru
 
LED Lighting Product Attachment
LED Lighting Product AttachmentLED Lighting Product Attachment
LED Lighting Product AttachmentUltra LEDs
 
cisco-c9120axe-h-datasheet.pdf
cisco-c9120axe-h-datasheet.pdfcisco-c9120axe-h-datasheet.pdf
cisco-c9120axe-h-datasheet.pdfHi-Network.com
 

Similaire à DMX-512 (20)

RGB constant voltage dmx decoder CT305R
RGB constant voltage dmx decoder CT305RRGB constant voltage dmx decoder CT305R
RGB constant voltage dmx decoder CT305R
 
Aspects Strategiques Des Réseaux 2008 2009
Aspects Strategiques Des Réseaux 2008 2009Aspects Strategiques Des Réseaux 2008 2009
Aspects Strategiques Des Réseaux 2008 2009
 
Driver Development for applications of networking services for a WAVE based d...
Driver Development for applications of networking services for a WAVE based d...Driver Development for applications of networking services for a WAVE based d...
Driver Development for applications of networking services for a WAVE based d...
 
SELTA Access Network Portfolio
SELTA Access Network PortfolioSELTA Access Network Portfolio
SELTA Access Network Portfolio
 
Sspi day out_2014_teledyne-paul_sandoval
Sspi day out_2014_teledyne-paul_sandovalSspi day out_2014_teledyne-paul_sandoval
Sspi day out_2014_teledyne-paul_sandoval
 
IBC 2014 - Broadcast Presentation
IBC 2014 - Broadcast PresentationIBC 2014 - Broadcast Presentation
IBC 2014 - Broadcast Presentation
 
ความรู้เกี่ยวกับ MikroTik Nstreme Version 2 (Nv2)
ความรู้เกี่ยวกับ MikroTik Nstreme Version 2 (Nv2)ความรู้เกี่ยวกับ MikroTik Nstreme Version 2 (Nv2)
ความรู้เกี่ยวกับ MikroTik Nstreme Version 2 (Nv2)
 
Networking basics
Networking basicsNetworking basics
Networking basics
 
Chap.1 ethernet introduction
Chap.1 ethernet introductionChap.1 ethernet introduction
Chap.1 ethernet introduction
 
Ccna pres
Ccna presCcna pres
Ccna pres
 
SIEMENS PXG3.L BACnet/IP Router
SIEMENS PXG3.L BACnet/IP RouterSIEMENS PXG3.L BACnet/IP Router
SIEMENS PXG3.L BACnet/IP Router
 
Accessing the Edge – with legacy communications and infrastructure
Accessing the Edge – with legacy communications and infrastructureAccessing the Edge – with legacy communications and infrastructure
Accessing the Edge – with legacy communications and infrastructure
 
Brkdct 3101
Brkdct 3101Brkdct 3101
Brkdct 3101
 
Ccna day5
Ccna day5Ccna day5
Ccna day5
 
Ccna day5
Ccna day5Ccna day5
Ccna day5
 
Ccna day5
Ccna day5Ccna day5
Ccna day5
 
Ccna day5-140715152501-phpapp01
Ccna day5-140715152501-phpapp01Ccna day5-140715152501-phpapp01
Ccna day5-140715152501-phpapp01
 
Wireless agro automation system
Wireless agro automation systemWireless agro automation system
Wireless agro automation system
 
LED Lighting Product Attachment
LED Lighting Product AttachmentLED Lighting Product Attachment
LED Lighting Product Attachment
 
cisco-c9120axe-h-datasheet.pdf
cisco-c9120axe-h-datasheet.pdfcisco-c9120axe-h-datasheet.pdf
cisco-c9120axe-h-datasheet.pdf
 

DMX-512

  • 1. DMX-512, Theatrical Stage Lighting Protocol Author: Parthiv Pandya
  • 2. Agenda • Introduction • Anatomy of the Protocol • Transmitter • Receiver • Test Setup • Questions DMX-512 9/30/2015 2
  • 3. Introduction • DMX-512A (Digital MultipleX), a communication protocol used popularly for stage lighting • Controls up to 512 separate channels/devices e.g. lighting fixtures • Low cost and robust • The standard is currently managed by the Entertainment Services & Technology Association (ESTA) DMX-512 9/30/2015 3
  • 4. Background (Technology Evolution) • Auto transformers • Manual control • Long wires • Analog controllers with 0-10 V analog console. • System was prone to noise • Dimming could be non linear depending on lamps • A separate control wire was required for each lamp • Digital technology became cost effective • Consoles required a new communication standard to allow different manufacturers to use one standard DMX-512 9/30/2015 4
  • 5. Anatomy of the Protocol 9/30/2015DMX-512 5
  • 6. Anatomy of the Protocol • Unidirectional asynchronous serial transmission protocol with one transmitter multiple receiver • Data is transmitted at 250K baud rate using RS-485 transmission standard over two wires and ground • Transmitter is connected to a receiver using a 5-pin or 3-pin XLR connector • Protocol does not provide handshake between receiver and transmitter or checking and correction mechanism • So not used in safety critical application. DMX-512 9/30/2015 6
  • 7. XLR Pin Connectors DMX-512 9/30/2015 7 XLR Pin Number DMX-512 Application Function 1 Common Common Reference 2 DMX Data - Primary Data Link 3 DMX Data +
  • 8. Timing Diagram and Timing Values DMX-512 Description Minimum Maximum Typical Unit Break 92 - 176 uSec Mark after Break (MAB) 12 <1,000,000 - uSec Bit Time 3.92 4.02 4 uSec DMX512 Packets 1204 1,000,000 - uSec 9/30/2015 8
  • 10. Transmitter • Software solution employs a simple state machine 1. SENDMBB – DMX data line is Idle 2. SENDBREAK – DMX data line is driven low 3. SENDMAB – DMX data line is Idle 4. SENDDATA – Bytes 0 to 511 of the DMX frame DMX-512 9/30/2015 10
  • 11. Transmitter State Machine DMX-512 SENDMBB DmxTxState = 0 State 1 SENDDATA DmxTxState = 3 State 4 SENDMAB DmxTxState = 2 State 3 SENDBREAK DmxTxState = 1 State 2 Wait for 100 uSec Wait for 100 uSec Wait for 100 uSec After 100 uSec After 100 uSec 512 bytes sent After 100 uSec 9/30/2015 11
  • 12. Generating Break Signal • Break signal: • Allows receivers to synchronize with the transmitter • Identifies the beginning of a new packet of data • EUSART module automatically generates a 12-bit long Break signal • This corresponds to 48 μs at 250k baud. • This is too short for use in a DMX512 application (min 92 uSec) DMX-512 9/30/2015 12
  • 13. Generating Break Signal (Cont.) • A 100Ω resistor connected in series with the MCUs EUSART transmit pin • Other end of the resistor to an I/O pin, say RC5 • When sending a Break signal, pin RC5 is driven low. Later Pin RC5 is tri-stated to allow the transmission from the EUSART to resume. • Break time can be varied in software, from 92 μSec to 176 μSec to meet the DMX protocol Break time specification DMX-512 9/30/2015 13
  • 14. Generating Break Signal (Cont.) To RS-485 Transceiver 100 Ω R TX RC5 DMX-512 9/30/2015 14
  • 15. Sending the Dimming Data • The dimming data is 8-bits wide • ‘0’ represents a light off and ‘255’ represents full intensity • EUSART is configured for 9-bit mode and 9th bit is set to ‘1’ to generate two stop bits DMX-512 9/30/2015 15
  • 16. Transmitter Demo – Dimming a Lamp DMX-512 9/30/2015 16 CCPR1 TMR 1 ADC Comparator UART To RS-485 Transceiver 100 Ω R TX RC5 RA0 Potentiometer
  • 20. Receiver Application Demo DMX-512 9/30/2015 20 CCPR2L TMR 2 UART From RS-485 Transceiver RX Comparator PWM
  • 23. PICDEM 2 Plus Board DMX-512 9/30/2015 23 Highlights: • Supports 18, 28 and 40-pin 8-bit devices • Prototype development area • Integrated input/output connectors and components • Connectivity to all Microchip Programmer/Debuggers/Emulators
  • 24. PICDEM 2 Plus Board Features 9/30/2015DMX-512 24 32 x 8 Serial (I2C) EEPROM 9 V, 100 mA AC/DC Wall Power Supply or 9V Battery LED (Unpopulated) Canned and Crystal Oscillator, RC Oscillator Potentiometer MSLR and Input Switches User Access for MCU Pins User Prototype Area RS232 port for UART
  • 25. References • PIC18F24J10 Data sheet (DS39682): The data sheet provides all the necessary information regarding the EUSART module, CCP module, ADC module and electrical characteristics of the PIC microcontroller. • PICDEM™ 2 PLUS User’s Guide (DS51275): This application note has been tested using a pair of PICDEM 2 PLUS demo boards. • American National Standard E1.11 – 2004: The official DMX512 protocol specifications DMX-512 9/30/2015 25

Notes de l'éditeur

  1. Transmitter State Machine Generating a Break Signal Circuit Schematic Receiver State Machine Circuit Schematic
  2. DMX-512A is a standard communication protocol used in theater stage lighting and fog controllers. It is used to control the dimmers, scanners, moving lights etc.. The protocol can be used to control up to 512 lighting fixtures to dim the lights, hence the number 512 in the naming convention. A copy of the protocol specifications can be purchased from the www.esta.org or the www.ansi.org
  3. Earlier auto transformer were used to control the light intensity A team required to manually control the transformers A long wire around the stage the supply the electricity Electronic auto transformer were used later Solved the manually operating issue resolved But still required cumbersome wiring around the stage. Eventually, analog controls took the place of auto-transformers, becoming quite popular, particularly the 0-10V analog consoles. Still, this system had three major drawbacks: 1. It was prone to noise. 2. Dimming could be nonlinear depending on different kinds of lamps. 3. A separate control wire was required for each lamp. As computer technology became more cost effective, new digital consoles came to the market and with them the need for a new standard that would allow equipment from different manufacturers to interoperate.
  4. XLR connectors are commonly used in professional audio, video and lighting applications. The connector has a rugged shell and a locking mechanism Protocol does not provide for any form of handshake between receiver and transmitter, nor does it offer any form of error checking, or correction mechanism.
  5. This can be a eye chart but, I put the timing diagram and values on one slide to make sure I do not have to change between slides and the audience can relate to them. Each DMX512 transmitter sends 512 8-bit dimming values, between 0 and 255, where 0 represents the lights off and 255 represents the maximum intensity. Each receiver connected to the DMX512 line can choose one of the 512 channels (address selection) to control its output lamp (load). The DMX512 protocol requires the transmitter to continuously repeat (at least once a second) the transmission of a frame as shown in the timing diagram in Figure 1 and Table 2.
  6. Figure the state machine. In this application, to simplify the code and still remain within the timing constrains, the SENDBREAK, SENDMAB and SENDMBB intervals were all set to 100 μSec. These timings can be easily changed if required. The Timer0 module is used to control the 100 μSec timing and the spacing between the transmitted bytes.
  7. As a demo application, we will use a potentiometer connected to the DMX512 transmitter to control remotely a lamp attached to a standard DMX512 receiver. The PIC24J10 has a 10-bit ADC module with 13 inputs. The potentiometer can be connected to pin RA0 of the MCU corresponding to the analog input channel 0. Since the Potentiometer won’t change very rapidly, sampling it every 10 mSec is sufficient. To generate an automatic and periodic activation of ADC, a convenient feature of the PIC18F24J10 MCU can be used. The ADC can start periodically a new conversion triggered by the CCP module. When the compare trigger occurs (TMR1 = CCPR1), the ADC conversion starts on the pre-selected input channel and TMR1 is reset. When ADC conversion is complete a new result is loaded into the ADRESH register and the ADIF flag is set When the ADIF bit is detected in the main loop, the transmitter will retrieve from ADRESH the most significant 8-bits encoding the potentiometer position and will transfer them to the transmission buffer at the position corresponding to the desired channel. The same channel will be selected at the dimming receiver for demonstration.
  8. The problem of receiving a DMX512 packet can be decomposed in three parts The first part is the synchronization of the receiver with the beginning of a new data packet identified by a prolonged Break condition of the line. This condition can be conveniently identified by a framing error flag reported by the UART. When the line is taken to the Break level, at the beginning of a new DMX512 packet, the UART initially interprets the condition as the beginning of a new data byte. But when, after the duration of the start bit and 8 more data bits instead of the two stop bits (MARK) the line remains in the break condition, a frame error is reported. Since there is no way to predict at which point of a transmission sequence the receiver will be activated during this phase the UART is polled continuously in a loop to discard any data received until a first framing error is detected. Once the Break condition is identified, the receiver needs to wait for the line to return to the idle state (mark) and a first byte of data to arrive. During this phase the UART is polled continuously as frame errors continue to be detected. Eventually the first byte received correctly is interpreted as the Start code. In this simple application only frames with a start code of 0 are received, frames begging with a different Start code (DMX512 extensions) are ignored. The last part consists, once more, of a loop where the receiver captures up to 512 bytes of data and stores them sequentially in the receiver buffer. A 12-bit pointer, available in PIC18F architecture, is used to provide linear memory access to the RAM memory space.
  9. Receiver Application Demo: In the previous section we saw how to get the DMX512 data for 512 channels and to store them in to a receiver buffer. In this section we will use the received data to control the PWM module of a PIC microcontroller. Connecting a LED to the PWM output pin we will observe the LED brightness change in response to DMX512 dimming commands The PIC18F24J10 Capture Compare and PWM (CCP) module offers 10-bit resolution. When used in PWM mode, it uses TMR2 as its time base and the PR2 register determines the PWM period. Since the DMX512 protocol provides only 8-bit of resolution for each channel, setting the PR2 register to 0xFF allows us to use just the 8 Most Significant Bits to control the duty cycle while still providing a PWM output frequency of approximately 16 KHz. This value greatly exceeds the minimum requirement of approximately 100 Hz. Usually considered sufficient to eliminate any visible flicker of the LED. Since the Most Significant 8 bits of the PWM duty cycle are controlled by CCPR2L register, it is sufficient to periodically update it copying the contents of the location corresponding to the desired DMX512 address (defined by the constant CHANNEL) from inside the receiver buffer. In the demonstration code, the CCPR2L register is updated every time a complete DMX512 frame has been received.
  10. To test the DMX512 transmitter and receiver, a separate pair of PICDEM™ 2 PLUS demo boards was used. The PICDEM 2 PLUS can be used to demonstrate the capabilities of 18, 28 and 40-pin PIC16 and PIC18 devices. The board has a small prototyping area where the transmitter and receiver transceiver circuits can be built. In order to take advantage of the (4) LEDs available on the board for the receiver demo, the output of the PIC18F24J10 CCP2 module can be redirected to PORTB output pin RB3 by modifying the microcontroller nonvolatile Configuration register CONFIG3H, ‘CCP2 MUX’ bit.