DMX512 send/recv library - DMX512 送受信ライブラリ

DMX512 send/recv library

DMX512 is protocol for lighting.

Break time: 100us
Mark After Break: 10us

http://www.sugakoubou.com/doku/_media/dmx/dmx512.png
RS-485

Serial port: p9, p10 or p13, p14 or p28, p27

Schematic

blockdiagram

	+--------+       +5V
	|        |        |
	|        |        |    LTC490    +[120]+
	|        |        |   +--__--+   |     |
	|        |        +---|1    8|---+-----|---(3 Rx) DMX in XLR 5P male (rx)
	|  mbed  |RXD---------|2    7|---------+---(2 Rx)
	|        |TXD---------|3    6|-------------(2 Tx) DMX out XLR 5P female (tx)
	|        |        +---|4    5|-------------(3 Tx)
	|        |        |   +------+
	|        |        |             +----------(1 Rx)
	|        |GND-----+-------------+----------(1 Tx)
	+--------+ 

Download

Import libraryDMX

DMX512 send/recv library http://mbed.org/users/okini3939/notebook/dmx512

Sample

Import programdmx_test

DMX512 library test http://mbed.org/users/okini3939/notebook/dmx512

Example

#include "mbed.h"
#include "DMX.h"

DMX dmx(p9, p10);

int main() {
    dmx.start();
      :
    dmx.put(0, 255);
      :
    i = dmx.get(0);
      :
}

Movie

VR -> (analog in) mbed (serial tx) -> Dimmer

DMX Controller -> (serial rx) mbed (pwm out) -> LED

This baseboard is "mbeduino"

Base board

mbed DMX Platform - DMX512プラットフォーム

Note

  • send break: LPC_UARTn->LCR |= (1 << 6)
  • recv break: LPC_UART3->LSR & ((1 << 7)|(1 << 3)|(1 << 4))
  • DMX出力をレジスタ直アクセス(高速)にする場合は #define DMX_DIRECT する。

Acknowledge

  • 送信時、最後のチャンネルのデータが途中で途切れる不具合修正(2011-06-13、感謝 Koichi Shibata様)
  • 512チャンネルに満たないDMX信号の受信不具合修正(感謝 Koichi Shibata様)


Report

7 comments on DMX512 send/recv library - DMX512 送受信ライブラリ:

27 Feb 2012

Hi, I´m very interested in the Base Board, but i´m not able to get it from the shop of the link, and i can not find it anywhere else... someone who knows where to get it?

17 Feb 2014

Hello,

Thank you for this library, I've been able to get this up and running without too much delay. My question is, if I want to control a single DMX light using a 2 channel mode, can I use this library to do that?

How would I specify data for each channel?

Thank you, Julie

I had a special moment there... Of course the channels are specified using the address. In case anyone else's brain melts slightly when doing DMX, here's how it's done...

If your light is set to a 2 channel mode at address 1, then address 1 (0 in this code) is channel one and address 2 (1 in this code) is channel two for the light.

17 Feb 2014

Hi, What is the 2 channel mode? For example, some moving lights have Pan/Tilt and Pan/Tilt Fine. Address 1: Pan (or Tilt), Address 2: Pan Fine (or Tilt Fine)

int n = 12345; /* 0-65535(256*256-1) */
dmx.put(0, n >> 8);
dmx.put(1, n & 0xff);

Are you sure about this?

06 Dec 2014

Sumimasenkedo FRDM-KL25Z wotsukaukara _uart ga naindesu

Error: Identifier "_uart" is undefined in "DMX/DMX.cpp", Line: 82, Col: 9

"RX" to "TX" wo tsukau hoo ga ii to omou kedo, bokiniwa, muzukashii desu.

Is there an easier way to do this, using just the UART, or do I need to scour the documentation for my board?

21 Aug 2016

Hi I'm struggling a bit to get a working receiving example to work. Would anyone be able to show me a simple single channel receiver code. For example controlling an led via PWM 0-255? Also as an extension to that if anyone has a good idea on how to do 16bit values over two dmx channels with this library.

Thanks very much, Alex

15 May 2017

<<quote jldpaula>> Hi, I´m very interested in the Base Board, but i´m not able to get it from the shop of the link, and i can not find it anywhere else... someone who knows where to get it? <</quote>>hello, what do you mean about base board? it is dmx512 led strip?

22 May 2017

<<quote alvin666>> <<quote jldpaula>> Hi, I´m very interested in the Base Board, but i´m not able to get it from the shop of the link, and i can not find it anywhere else... someone who knows where to get it? <</quote>>hello, what do you mean about base board? it is dmx512 led strip? <</quote>>yeah, and how can write the code? it is difficult for me. Every ic have it is address,right? If write the addess,1-50,then,start from 52 is ok? appreciated your help.

Please log in to post comments.