Since DMX seemed to be taking over most of my projects recently, I decided to create a simple plug-in module that would handle DMX decoding. I could then plug this module into various projects and not have to rewrite the same code over and over again.
From research of what was in the public domain already, it was obvious that a PIC was the accepted way to go with this. I've already created a PIC based decoder, but I thought that a better solution existed in the depths of my mind - one that would be capable of simple modification without worrying about accurate timing loops etc! The obvious solution was to implement in programmable logic.
After some mucking around in Altera's design software (Quartus II), the design below was created. This uses a single EPM7128 device and generates 6 PWM outputs as can be seen in the simulation output. The DMX address can be set anywhere from 0 to 255 (256 to 512 are ignored) and the 6 PWM channels occupy single adjacent addresses..
Download the complete Quartus II project here.
The design uses 127 of the 128 macrocells which is a bit of a tight fit to say the least, but I've got a handful of EPM7128's kicking around and buying even more devices seemed a bit daft.
The VHDL code is based on Ovidiu Lupas's 'miniUART' source files from http://www.opencores.org, and has been extensively trimmed and modified to cater for DMX protocols. I'm fairly new to the whole VHDL thing, so if you think this code looks primitive, it probably is. Suggestions for improvements are welcome!
Possible uses for this system are:
-Use 3 channels to drive RGB leds.
- Filter the PWM output, amplify x2, and use it to convert DMX to +10V analogue protocols. This was the intention for this circuit, as I had a number of analogue dimmer packs that could be upgraded to DMX as long as it was a cheap solution!
- Modify the PWM timing to drive R/C servos directly
- Modify the PWM and sync to 50Hz to drive triacs - hey presto, a 6 channel DMX dimmer pack!