Skip to content

Commit 481a5ff

Browse files
committed
update
1 parent 4f2a80d commit 481a5ff

File tree

29 files changed

+3974
-0
lines changed

29 files changed

+3974
-0
lines changed

Licence.md renamed to CHANGELOG.md

File renamed without changes.

LICENCE.md

Lines changed: 675 additions & 0 deletions
Large diffs are not rendered by default.

Librerias/._.DS_Store

4 KB
Binary file not shown.
Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
/*************************************************************************************************************
2+
*
3+
* Title : Example DMX Muxer with channel patch for Arduino 4 universes DMX library.
4+
* Version : v 0.3
5+
* Last updated : 07.07.2012
6+
* Target : Arduino mega 2560, Arduino mega 1280
7+
* Author : Toni Merino - merino.toni at gmail.com
8+
* Web : www.deskontrol.net/blog
9+
*
10+
**************************************************************************************************************/
11+
#include <lib_dmx.h> // comment/uncomment #define USE_UARTx in lib_dmx.h as needed
12+
13+
// This sample get the first 200 channels from universe 1 + the first 200 channels from universe 2, and write all
14+
// to universe 3 (addresses 1-200 from universe 2 are converted to 201-400)
15+
16+
//*********************************************************************************************************
17+
// New DMX modes *** EXPERIMENTAL ***
18+
//*********************************************************************************************************
19+
#define DMX512 (0) // (250 kbaud - 2 to 512 channels) Standard USITT DMX-512
20+
#define DMX1024 (1) // (500 kbaud - 2 to 1024 channels) Completely non standard - TESTED ok
21+
#define DMX2048 (2) // (1000 kbaud - 2 to 2048 channels) called by manufacturers DMX1000K, DMX 4x or DMX 1M ???
22+
23+
void setup()
24+
{
25+
26+
ArduinoDmx1.set_control_pin(24); // Arduino output pin for MAX485 input/output control (connect to MAX485-1 pins 2-3)
27+
ArduinoDmx2.set_control_pin(26); // Arduino output pin for MAX485 input/output control (connect to MAX485-2 pins 2-3)
28+
ArduinoDmx3.set_control_pin(28); // Arduino output pin for MAX485 input/output control (connect to MAX485-3 pins 2-3)
29+
30+
ArduinoDmx1.set_rx_address(1); // set rx1 start address
31+
ArduinoDmx2.set_rx_address(1); // set rx2 start address
32+
ArduinoDmx3.set_tx_address(1); // set tx start address
33+
34+
ArduinoDmx1.set_rx_channels(200); // 2 to 2048!! channels in DMX1000K (512 in standard mode) See lib_dmx.h *** new *** EXPERIMENTAL
35+
ArduinoDmx2.set_rx_channels(200); // 2 to 2048!! channels in DMX1000K (512 in standard mode) See lib_dmx.h *** new *** EXPERIMENTAL
36+
ArduinoDmx3.set_tx_channels(400); // 2 to 2048!! channels in DMX1000K (512 in standard mode) See lib_dmx.h *** new *** EXPERIMENTAL
37+
38+
// New parameter needed: DMX Mode
39+
ArduinoDmx1.init_rx(DMX512); // starts universe 1 as rx, standard DMX 512 - See lib_dmx.h, now support for DMX faster modes (DMX 1000K)
40+
ArduinoDmx2.init_rx(DMX512); // starts universe 2 as rx, standard DMX 512 - See lib_dmx.h, now support for DMX faster modes (DMX 1000K)
41+
ArduinoDmx3.init_tx(DMX512); // starts universe 3 as tx, standard DMX 512 - See lib_dmx.h, now support for DMX faster modes (DMX 1000K)
42+
43+
}//end setup()
44+
45+
void loop()
46+
{
47+
// copy 200 channels from rx buffer 1 to tx buffer 3
48+
memcpy((void *)ArduinoDmx3.TxBuffer, (void *)ArduinoDmx1.RxBuffer, 200);
49+
50+
// copy 200 channels from rx buffer 2 to tx buffer 3, position 200 (patch from 1-200 to 201-400)
51+
memcpy((void *)&ArduinoDmx3.TxBuffer[200], (void *)ArduinoDmx2.RxBuffer, 200);
52+
53+
}//end loop()
54+
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
/*************************************************************************************************************
2+
*
3+
* Title : Example HTP DMX Muxer for Arduino 4 universes DMX library.
4+
* Version : v 0.3
5+
* Last updated : 07.07.2012
6+
* Target : Arduino mega 2560, Arduino mega 1280
7+
* Author : Toni Merino - merino.toni at gmail.com
8+
* Web : www.deskontrol.net/blog
9+
*
10+
**************************************************************************************************************/
11+
#include <lib_dmx.h> // comment/uncomment #define USE_UARTx in lib_dmx.h as needed
12+
13+
// This sample get 512 channels from universe 1 + 512 channels from universe 2,
14+
// and write the highgest value to universe 3
15+
16+
//*********************************************************************************************************
17+
// New DMX modes *** EXPERIMENTAL ***
18+
//*********************************************************************************************************
19+
#define DMX512 (0) // (250 kbaud - 2 to 512 channels) Standard USITT DMX-512
20+
#define DMX1024 (1) // (500 kbaud - 2 to 1024 channels) Completely non standard - TESTED ok
21+
#define DMX2048 (2) // (1000 kbaud - 2 to 2048 channels) called by manufacturers DMX1000K, DMX 4x or DMX 1M ???
22+
23+
void setup()
24+
{
25+
26+
ArduinoDmx1.set_control_pin(24); // Arduino output pin for MAX485 input/output control (connect to MAX485-1 pins 2-3)
27+
ArduinoDmx2.set_control_pin(26); // Arduino output pin for MAX485 input/output control (connect to MAX485-2 pins 2-3)
28+
ArduinoDmx3.set_control_pin(28); // Arduino output pin for MAX485 input/output control (connect to MAX485-3 pins 2-3)
29+
30+
ArduinoDmx1.set_rx_address(1); // set rx1 start address
31+
ArduinoDmx2.set_rx_address(1); // set rx2 start address
32+
ArduinoDmx3.set_tx_address(1); // set tx start address
33+
34+
ArduinoDmx1.set_rx_channels(512); // 2 to 2048!! channels in DMX1000K (512 in standard mode) See lib_dmx.h *** new *** EXPERIMENTAL
35+
ArduinoDmx2.set_rx_channels(512); // 2 to 2048!! channels in DMX1000K (512 in standard mode) See lib_dmx.h *** new *** EXPERIMENTAL
36+
ArduinoDmx3.set_tx_channels(512); // 2 to 2048!! channels in DMX1000K (512 in standard mode) See lib_dmx.h *** new *** EXPERIMENTAL
37+
38+
// New parameter needed in init_tx and init_rx: DMX Mode
39+
ArduinoDmx1.init_rx(DMX512); // starts universe 1 as rx, standard DMX 512 - See lib_dmx.h, now support for DMX faster modes (DMX 1000K)
40+
ArduinoDmx2.init_rx(DMX512); // starts universe 2 as rx, standard DMX 512 - See lib_dmx.h, now support for DMX faster modes (DMX 1000K)
41+
ArduinoDmx3.init_tx(DMX512); // starts universe 3 as tx, standard DMX 512 - See lib_dmx.h, now support for DMX faster modes (DMX 1000K)
42+
43+
}//end setup()
44+
45+
void loop()
46+
{
47+
for(int i=0;i<512;i++) //buffers 0 indexed (0-511)
48+
{
49+
// copy values from input buffers to output buffer
50+
// High value take priority ( HTP )
51+
if(ArduinoDmx1.RxBuffer[i] > ArduinoDmx2.RxBuffer[i])
52+
ArduinoDmx3.TxBuffer[i] = ArduinoDmx1.RxBuffer[i];
53+
else
54+
ArduinoDmx3.TxBuffer[i] = ArduinoDmx2.RxBuffer[i];
55+
}
56+
} //end loop()
57+
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/*************************************************************************************************************
2+
*
3+
* Title : Example DMX Receiver
4+
* Version : v 0.3
5+
* Last updated : 07.07.2012
6+
* Target : Arduino mega 2560, Arduino mega 1280, Arduino nano
7+
* Author : Toni Merino - merino.toni at gmail.com
8+
* Web : www.deskontrol.net/blog
9+
*
10+
**************************************************************************************************************/
11+
#include <lib_dmx.h> // comment/uncomment #define USE_UARTx in lib_dmx.h as needed
12+
13+
// This example receive 4 channels from address 1 to 4 and write analog values to PWM pins 2 to 5
14+
15+
// outputs update in main loop
16+
17+
18+
//*********************************************************************************************************
19+
// New DMX modes *** EXPERIMENTAL ***
20+
//*********************************************************************************************************
21+
#define DMX512 (0) // (250 kbaud - 2 to 512 channels) Standard USITT DMX-512
22+
#define DMX1024 (1) // (500 kbaud - 2 to 1024 channels) Completely non standard - TESTED ok
23+
#define DMX2048 (2) // (1000 kbaud - 2 to 2048 channels) called by manufacturers DMX1000K, DMX 4x or DMX 1M ???
24+
25+
void setup()
26+
{
27+
ArduinoDmx0.set_control_pin(22); // Arduino output pin for MAX485 input/output control (connect to MAX485 pins 2-3)
28+
ArduinoDmx0.set_rx_address(1); // set rx0 dmx start address
29+
ArduinoDmx0.set_rx_channels(4); // number of rx channels
30+
ArduinoDmx0.init_rx(DMX512); // starts universe 0 as rx, NEW Parameter DMX mode
31+
32+
} //end setup()
33+
34+
void loop()
35+
{
36+
//write values from dmx channels 1-4 universe 0 to arduino pwm pins 2-5
37+
analogWrite(2, ArduinoDmx0.RxBuffer[0]); //buffers 0 indexed
38+
analogWrite(3, ArduinoDmx0.RxBuffer[1]);
39+
analogWrite(4, ArduinoDmx0.RxBuffer[2]);
40+
analogWrite(5, ArduinoDmx0.RxBuffer[3]);
41+
} //end loop()
42+
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
/*************************************************************************************************************
2+
*
3+
* Title : Example DMX mode conversion and reception with 3 Universes chained
4+
* Version : v 0.3
5+
* Last updated : 07.07.2012
6+
* Target : Arduino mega 2560, Arduino mega 1280
7+
* Author : Toni Merino - merino.toni at gmail.com
8+
* Web : www.deskontrol.net/blog
9+
*
10+
**************************************************************************************************************/
11+
#include <lib_dmx.h> // comment/uncomment #define USE_UARTx in lib_dmx.h as needed
12+
13+
// This example test 3 universes at one time with diferent DMX modes: RX-3 DMX-512 - TX-2 DMX-1000K - RX-1 DMX-1000K
14+
// and handle 512 input channels + 512 output channels + 512 input channels, asincronous data updates in main loop.
15+
// GoooOOO Arduino
16+
17+
// *** Place a wire loop between output pin of universe 2 (Arduino pin 16 - TX2) and universe 1 input pin (Arduino pin 19 - RX1) ***
18+
19+
// Signal from external controller, inputs at universe 3 RX, copies universe 3 input buffer to universe 2 output buffer and loops
20+
// with a wire to universe 1 input, then received data on universe 1 is write to analog output pins...
21+
// (all proccess with 512 channels, but only 4 DMX channels are written to Arduino PWM outputs)
22+
23+
// Remember:
24+
// Standard DMX-512 signal from controller is applied to universe 3 input pin (Arduino pin 15 - RX3), data received in
25+
// universe 3 INPUT buffer are copied in main loop to universe 2 OUTPUT buffer, and transmitted by universe 2 in DMX-1000K mode,
26+
// then received by universe 1 in DMX-1000K mode (via the loop wire), and received values from first 4 channels written
27+
// to Arduino PWM pins 2 to 5... Enjoy ;)
28+
29+
// Is this useful???
30+
// Advantages are clear, DMX-1000K is 4 times faster than USITT DMX512, 4 times faster is 168 Hz refresh rate with 512 channels,
31+
// or 4 times faster is 4 times more channels in one universe at DMX standard refresh rate of 42 Hz.
32+
// Many manufacturers are producing led matrix and other led systems and controllers with unknow (for me) specification
33+
// called DMX-1000K: unoficial?, but standard de facto...
34+
35+
// If you have any information about strange DMX modes used by led lighting, (DMX derivates like 1536 channels mode, modes
36+
// with/without break and other funny modes, not SPI) please contact me.
37+
38+
//*********************************************************************************************************
39+
// New DMX modes *** EXPERIMENTAL ***
40+
//*********************************************************************************************************
41+
#define DMX512 (0) // (250 kbaud - 2 to 512 channels) Standard USITT DMX-512
42+
#define DMX1024 (1) // (500 kbaud - 2 to 1024 channels) Completely non standard - TESTED ok
43+
#define DMX2048 (2) // (1000 kbaud - 2 to 2048 channels) called by manufacturers DMX1000K, DMX 4x or DMX 1M ???
44+
45+
#define CHANNELS (512)
46+
47+
void setup()
48+
{
49+
ArduinoDmx3.set_rx_address(1); // set RX 3 DMX start address
50+
ArduinoDmx3.set_rx_channels(CHANNELS); // number of RX channels universe 3
51+
ArduinoDmx3.init_rx( DMX512 ); // starts universe 3 as RX (DMX input from external controller), DMX mode: standard USITT DMX-512
52+
53+
ArduinoDmx2.set_tx_address(1); // set TX 2 DMX start address
54+
ArduinoDmx2.set_tx_channels(CHANNELS); // number of TX channels
55+
ArduinoDmx2.init_tx( DMX2048 ); // starts universe 2 as TX (wire loop to universe 1), DMX mode: DMX2048 (DMX1000K)
56+
57+
ArduinoDmx1.set_rx_address(1); // set RX 1 DMX start address
58+
ArduinoDmx1.set_rx_channels(CHANNELS); // number of RX channels
59+
ArduinoDmx1.init_rx( DMX2048 ); // starts universe 1 as RX (wire loop from universe 2), DMX mode: DMX2048 (DMX1000K)
60+
61+
} //end setup()
62+
63+
void loop()
64+
{
65+
// copy data from RX 3 buffer to TX 2 buffer
66+
memcpy((void *)ArduinoDmx2.TxBuffer, (void *)ArduinoDmx3.RxBuffer, CHANNELS);
67+
68+
// write values from RX 1 buffer, (dmx channels 1-4 only, to arduino pwm pins 2-5)
69+
analogWrite(2, ArduinoDmx1.RxBuffer[0]); // DMX channel 1 (buffers 0 indexed)
70+
analogWrite(3, ArduinoDmx1.RxBuffer[1]);
71+
analogWrite(4, ArduinoDmx1.RxBuffer[2]);
72+
analogWrite(5, ArduinoDmx1.RxBuffer[3]);
73+
} //end loop()
74+
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
/*************************************************************************************************************
2+
*
3+
* Title : Example DMX mode conversion and reception with 3 Universes chained
4+
* Version : v 0.3
5+
* Last updated : 07.07.2012
6+
* Target : Arduino mega 2560, Arduino mega 1280
7+
* Author : Toni Merino - merino.toni at gmail.com
8+
* Web : www.deskontrol.net/blog
9+
*
10+
**************************************************************************************************************/
11+
#include <lib_dmx.h> // comment/uncomment #define USE_UARTx in lib_dmx.h as needed
12+
13+
// This example test 3 universes at one time with diferent DMX modes: RX-3 DMX-512 - TX-2 DMX1000K - RX-1 DMX1000K
14+
// and handle 512 input channels + 2048 output channels + 2048 input channels, asincronous data updates in main loop.
15+
// GoooOOO Arduino
16+
17+
// *** Place a wire loop between output pin of universe 2 (Arduino pin 16 - TX2) and universe 1 input pin (Arduino pin 19 - RX1) ***
18+
19+
// Signal from external controller, inputs at universe 3 RX, copies universe 3 input buffer to universe 2 output buffer and loops
20+
// with a wire to universe 1 input, then received data on universe 1 is write to analog output pins...
21+
22+
// Remember:
23+
// Standard DMX-512 signal from external controller is applied to MAX 485 in universe 3 input pin (Arduino pin 15 - RX3), data received in
24+
// universe 3 INPUT buffer are copied in main loop to universe 2 OUTPUT buffer (4 times to fill 2048 channels), and transmitted
25+
// by universe 2 in DMX-1000K (2048 channels) mode, then received by universe 1 in DMX-1000K (2048 channels) mode (via the loop wire),
26+
// and received value from original input channel 512 written to PWM pins 2 to 5.
27+
28+
// And voila, our original value from input channel 512 is now at DMX-1000K channels 512-1024-1536-2048, Enjoy ;)
29+
30+
// Is this useful???
31+
// Advantages are clear, DMX-1000K is 4 times faster than USITT DMX512, 4 times faster is 168 Hz refresh rate with 512 channels,
32+
// or 4 times faster is 4 times more channels in one universe at DMX standard refresh rate of 42 Hz.
33+
// Many manufacturers are producing led matrix and other led systems and controllers with unknow (for me) specification
34+
// called DMX-1000K: unoficial?, but standard de facto...
35+
36+
// If you have any information about strange DMX modes used by led lighting, (DMX derivates like 1536 channels mode, modes
37+
// with/without break and other funny modes, not SPI) please contact me.
38+
39+
//*********************************************************************************************************
40+
// New DMX modes *** EXPERIMENTAL ***
41+
//*********************************************************************************************************
42+
#define DMX512 (0) // (250 kbaud - 2 to 512 channels) Standard USITT DMX-512
43+
#define DMX1024 (1) // (500 kbaud - 2 to 1024 channels) Completely non standard - TESTED ok
44+
#define DMX2048 (2) // (1000 kbaud - 2 to 2048 channels) called by manufacturers DMX1000K, DMX 4x or DMX 1M ???
45+
46+
#define CHANNELS (512)
47+
48+
void setup()
49+
{
50+
ArduinoDmx3.set_rx_address(1); // set RX 3 DMX start address
51+
ArduinoDmx3.set_rx_channels(CHANNELS); // number of RX channels universe 3
52+
ArduinoDmx3.init_rx( DMX512 ); // starts universe 3 as RX (DMX input from external controller), DMX mode: standard USITT DMX-512
53+
54+
ArduinoDmx2.set_tx_address(1); // set TX 2 DMX start address
55+
ArduinoDmx2.set_tx_channels(CHANNELS * 4); // number of TX channels
56+
ArduinoDmx2.init_tx( DMX2048 ); // starts universe 2 as TX (wire loop to universe 1), DMX mode: DMX2048 (DMX1000K)
57+
58+
ArduinoDmx1.set_rx_address(1); // set RX 1 DMX start address
59+
ArduinoDmx1.set_rx_channels(CHANNELS * 4); // number of RX channels
60+
ArduinoDmx1.init_rx( DMX2048 ); // starts universe 1 as RX (wire loop from universe 2), DMX mode: DMX2048 (DMX1000K)
61+
62+
} //end setup()
63+
64+
void loop()
65+
{
66+
// copy data from RX 3 buffer to TX 2 buffer 4 times (repeat values 4 times in order to fill 2048 output channels of DMX1000K)
67+
68+
// To channels 1-512
69+
memcpy((void *)ArduinoDmx2.TxBuffer, (void *)ArduinoDmx3.RxBuffer, CHANNELS);
70+
// To channels 513-1024
71+
memcpy((void *)&ArduinoDmx2.TxBuffer[512], (void *)ArduinoDmx3.RxBuffer, CHANNELS);
72+
// To channels 1025-1536
73+
memcpy((void *)&ArduinoDmx2.TxBuffer[1024], (void *)ArduinoDmx3.RxBuffer, CHANNELS);
74+
// To channels 1537-2048
75+
memcpy((void *)&ArduinoDmx2.TxBuffer[1536], (void *)ArduinoDmx3.RxBuffer, CHANNELS);
76+
77+
// write values from RX 1 buffer, (dmx channel 512 only, to arduino pwm pins 2-5)
78+
analogWrite(2, ArduinoDmx1.RxBuffer[2047]); // DMX input channel 512 -> DMX1000K channel 2048
79+
analogWrite(3, ArduinoDmx1.RxBuffer[1535]); // DMX input channel 512 -> DMX1000K channel 1536
80+
analogWrite(4, ArduinoDmx1.RxBuffer[1023]); // DMX input channel 512 -> DMX1000K channel 1024
81+
analogWrite(5, ArduinoDmx1.RxBuffer[511]); // DMX input channel 512 -> DMX1000K channel 512
82+
} //end loop()
83+

0 commit comments

Comments
 (0)