DMX send and receive with some signal modification


good morning ladies , gentlemen of arduino forum.
so...

my problem have dmx device hard adressed channels 1 through 4.
this can annoying in venues (it's going on tour theatre show soon) i'm trying use arduino modified dmx shield fix problem.

basically want receive dmx @ address specify (through dip switches) , redirect information dmx adresses 1 through 4.
the catch need other dmx information passed on without modification.

i have no problems building shield it's coding side fall down *sigh*

i've looked around , found other peoples code sends dmx , receives it, , have slapped toghether modifications of own (based on hope , guesswork)

i'm wont work (there's don't understand) i'm going take break, build shield, try find usb atob cable in mess room , post code in hopes wonderful people can me debug it. :)

part 1


code: [select]

/* cobbled genehed
*----------------------------
this sketch uses borrowed elements dmxlab_2__fade in , out all

* (cleft) 2006 tomek ness , d. cuartielles
* k3 - school of arts , communication
* fhp - university of applied sciences
* <http://www.arduino.cc>
* <http://www.mah.se/k3>
* <http://www.design.fh-potsdam.de>
*
* @date: 2006-09-30
* @idea: tomek ness
* @code: d. cuartielles , tomek ness
* @acknowledgements: johny lowgren dmx devices
*
and
/***********************************************************

* dmx-512 reception                                        *

* developed max pierson                                 *

* version rev12 12 may 2009                                *

* released under wtfpl license, although       *

* appreciate attribution , share-alike                   *

* see blog.wingedvictorydesign.com latest version. *

************************************************************

the purpose recieve dmx settable address (8 dip switches) , change dmx outputs 1 through 4. while still sending else.
hopefully i've understood code i'm borrowing , changes work :)
using 2 max-485 chips (ic1(send) , ic2(receive)) have them , may well

my arduino pin lay out
0  rxpin recieving dmx signal ic2
1  txpin driver input on ic2
2  add 1
3  add 2
4  add 4
5  add 8
6  add 16
7  add 32
8  add 64
9  add 128
10
11    dmx out ic1
12    
13    error check led

analouge
aref
0
1
2
3
4  to reciever enable ic2
5  to driver enable ic2

/* dmx shift out arduino - 004 , 005

*
* (cleft) 2006 tomek ness , d. cuartielles
* k3 - school of arts , communication
* fhp - university of applied sciences
* <http://www.arduino.cc>
* <http://www.mah.se/k3>
* <http://www.design.fh-potsdam.de>
*
* @date: 2006-09-30
* @idea: tomek ness
* @code: d. cuartielles , tomek ness
* @acknowledgements: johny lowgren dmx devices
*/
#include "pins_arduino.h"

int sig = 11;           // signal

int count = 0;


/* sends dmx byte out on pin.  assumes 16 mhz clock.
* disables interrupts, disrupt millis() function if used
* frequently. */
void shiftdmxout(int pin, int thebyte)
{
 int port_to_output[] = {
   not_a_port,
   not_a_port,
   _sfr_io_addr(portb),
   _sfr_io_addr(portc),
   _sfr_io_addr(portd)
   };

   int portnumber = port_to_output[digitalpintoport(pin)];
 int pinmask = digitalpintobitmask(pin);

 // first thing write te pin high
 // mark between bytes. may also
 // high before
 _sfr_byte(_sfr_io8(portnumber)) |= pinmask;
 delaymicroseconds(10);

 // disable interrupts, otherwise timer 0 overflow interrupt that
 // tracks milliseconds make delay longer want.
 cli();

 // dmx starts start-bit must zero
 _sfr_byte(_sfr_io8(portnumber)) &= ~pinmask;

 // need delay of 4us (then 1 bit transfered)
 // seems more stable using delaymicroseconds
 asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
 asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");

 asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
 asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");

 asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
 asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");

 for (int = 0; < 8; i++)
 {
   if (thebyte & 01)
   {
     _sfr_byte(_sfr_io8(portnumber)) |= pinmask;
   }
   else
   {
     _sfr_byte(_sfr_io8(portnumber)) &= ~pinmask;
   }

   asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
   asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");

   asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
   asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");

   asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");
   asm("nop\n nop\n nop\n nop\n nop\n nop\n nop\n nop\n");

   thebyte >>= 1;
 }

 // last thing write pin high
 // mark between bytes. (this break have between 8 , 1 sec)
 _sfr_byte(_sfr_io8(portnumber)) |= pinmask;

 // reenable interrupts.
 sei();
}
/******************************* addressing variable declarations *****************************     */
 int add1 = 0;
 int add2 = 0;  
 int add4 = 0;
 int add8 = 0;
 int add16 = 0;
 int add32 = 0;
 int add64 = 0;
 int add128 = 0;

unsigned int dmxaddress = 1;
 int pinadd1 = 2;
 int pinadd2 = 3;
 int pinadd4 = 4;
 int pinadd8 = 5;
 int pinadd16 = 6;
 int pinadd32 = 7;
 int pinadd64 = 8;
 int pinadd128 = 9;

/* dmx address listening to.  the value of set in addressing()*/



Arduino Forum > Forum 2005-2010 (read only) > Software > Syntax & Programs > DMX send and receive with some signal modification


arduino

Comments

Popular posts from this blog

CAN'T INSTALL MAMBELFISH 1.5 FROM DIRECTORY - Joomla! Forum - community, help and support

error: expected initializer before 'void'

CPU load monitoring using GPIO and leds - Raspberry Pi Forums