Shop OBEX P1 Docs P2 Docs Learn Events
Receiving DMX — Parallax Forums

Receiving DMX

rapscaLLionrapscaLLion Posts: 75
edited 2010-06-11 05:22 in Propeller 1
Hi all,

I'm sure I've made a silly oversight here, but I can't figure out where I've gone wrong so appreciate your input and guidance.

I have set up a simple DMX receiver on a demo board. I have sent DMX no problem with a similar setup, so I reconfigured the wiring to match the diagram in Timothy D Swieter's DMX_RX_Driver (except using the SN equivalent instead of the MAX chip). The circuit seems to "receive" the dmx stream just fine, however I've output to decimal values to a TV terminal similar to Timothy's DMX Object Demo. Regardless of which combination of various DMX RX objects and TV Text objects I try, I get the same results: Each channel returns "254" when it should be zero. Incrementing/decrementing a channel value by one (out of 255) changes the displayed channel level by seemingly random values from 2 - 200+. Additionally, at some points in the scale adjacent channels are affected as well. I hope this is clear... it doesn't make much sense to me.

Is this a problem with my setup, or in the code? I feel like there is a problem with the memory allocation or handling since changing one channel's level also affects adjacent channels at certain points, but I haven't been able to figure it out either way.

Code is as follows:

CON               'Constants to be located here
'***************************************
'  Hardware related settings
'***************************************
  _clkmode = xtal1 + pll16x                             'Use the PLL to multiple the external clock by 16
  _xinfreq = 5_000_000                                  'An external clock of 5MHz. is used (80MHz. operation)

'***************************************
'  System Definitions      
'***************************************

  _OUTPUT       = 1             'Sets pin to output in DIRA register
  _INPUT        = 0             'Sets pin to input in DIRA register  
  _HIGH         = 1             'High=ON=1=3.3v DC
  _ON           = 1
  _LOW          = 0             'Low=OFF=0=0v DC
  _OFF          = 0
  _ENABLE       = 1             'Enable (turn on) function/mode
  _DISABLE      = 0             'Disable (turn off) function/mode

'***************************************
'  Program Definitions     
'***************************************

  _channel      = 1             'Channel to read
  
VAR               'Variables to be located here

  byte  myvariable              'a variable to be manipulated by DMX

OBJ               'Object declaration to be located here

  DMX           : "DMX_Rx_Driver_Ver014.spin"
  num           : "Simple_Numbers"
  tv          : "tv_text"
  
PUB main | ch,temp,x,y

  tv.start(12)
  tv.str(string(13, 1,"    --This is the DMX Object Demo--",13))   

  'Start the object (replace the pin numbers with the correct pins for your setup
  DMX.start(0, 20)  

  repeat
      ch := 1 
      repeat y from 1 to 12
        repeat x from 1 to 35 step 4
          tv.out($0A)
          tv.out(x)
          tv.out($0B) 
          tv.out(y)
          tv.dec(DMX.level(ch)) 
          ch++   




Any and all help greatly appreciated, before I start banging my head into the wall [noparse]:)[/noparse]

Comments

  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-06-10 14:51
    I would start easier at first -- DMX is simple and having used Tim's code I know it works. You might want to create another test program that spits results out to a serial terminal (e.g. PST) so that you can verify your DMX hardware/connections.

    This article I wrote for Nuts & Volts may help, too: www.parallax.com/Portals/0/Downloads/docs/cols/nv/prop/col/nvp3.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • rapscaLLionrapscaLLion Posts: 75
    edited 2010-06-10 18:52
    Thanks JonnyMac. I get similar results using PST. Any other thoughts? The numbers I was getting using the TV terminal were impossible (channel values ranging from 0 - 800, far outside the byte range). The PST is giving me values between 0 and 254, but they still don't make any sense and don't increment or decrement as they should. A zero value on a channel gives me 254 in the terminal. The values seem to decrement by 4 for every increase of 1 in the dmx level. A full on (255) on one channel shows as "2" in the terminal, however the next adjacent channel is also affected when it shouldn't be.

    Help!?

    Post Edited (rapscaLLion) : 6/10/2010 6:59:40 PM GMT
  • rapscaLLionrapscaLLion Posts: 75
    edited 2010-06-10 19:08
    Okay... embarrassingly enough I had the + and - on the DMX line reversed... all seems to be working fine now. Thanks!
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-06-10 19:40
    I'm going to suggest that you may have a hardware problem. I connected my DMX board and whipped up the attached program -- works as intended. My DMX board is a mini, 6-channel console and I can see individual as well as master control of those channels in PST. I've attached my code which includes my latest DMX RX object.

    I hope this helps.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
    491 x 465 - 131K
  • JonnyMacJonnyMac Posts: 9,208
    edited 2010-06-10 19:43
    I made the post above without refreshing the browser; glad you got it sorted. My DMX receiver works a little differently than Tim's in that I use hardware timers for the break detection and for loss-of-signal detection. My 6-channel console only spits out seven bytes after the break so my original version would not light the LED very brightly. The version attached above will keep the DMX signal detect LED on for N milliseconds until signal is lost; this gives a better display for small consoles like I'm using.

    Congrats on tracking down your bug -- sometime the smallest bugs bite the hardest!

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon McPhalen
    Hollywood, CA
  • rapscaLLionrapscaLLion Posts: 75
    edited 2010-06-10 20:08
    Hi,

    Thanks for all your effort. I'll take a look at your code anyhow to see where I might be able to improve.
    I have successfully mated the DMX in code with BrillIdea's SPL output for the Allegro A6281 chip. Everything is beautiful, and now I get to spend the night soldering together 3 controllers [noparse]:)[/noparse]

    Thanks again!
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2010-06-10 23:20
    Rapscallion -

    Sounds like you and I are on the same path of mating DMX with the A6281. I have a couple controllers I am cooking up for a new LED Painter II. In the process I hope to revise the A6281 code and the DMX code.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, P.E.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" 16:9 LCD Composite video display, eProto for SunSPOT, PropNET, PolkaDOT-51
    www.tdswieter.com
  • rapscaLLionrapscaLLion Posts: 75
    edited 2010-06-11 04:45
    Sounds awesome! The A6281 is a great chip. Thanks to your pioneering code in the obex, this project seems to be working out well!
  • Timothy D. SwieterTimothy D. Swieter Posts: 1,613
    edited 2010-06-11 05:22
    Thanks for the compliments. The new version of the A6281 driver will be done fully in ASM and be blazing fast.

    For the current drier, I have had two people - both of whom I trust - tell me that there is an oddity in the buffer and displaying values on the A6281. There may be an off-by-one error. I haven't taken time to look at it yet because I know the new LED Painter II controllers will cause me to review the code when I need to. If you see the problem and can propose a simple solution, then I can quickly update the code in the OBEX.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Timothy D. Swieter, P.E.
    www.brilldea.com - Prop Blade, LED Painter, RGB LEDs, 3.0" 16:9 LCD Composite video display, eProto for SunSPOT, PropNET, PolkaDOT-51
    www.tdswieter.com
Sign In or Register to comment.