Dmx Solved !!!!!!!


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Posts
    20


    Did you find this post helpful? Yes | No

    Default Thanks!

    Thanks, John, for your help! I will be coding my gizmo in the next few days and those snippets will be very helpful in getting it up and running!

    I'll let you know how it goes...

    Thanks again--

    --Alan

  2. #2
    Join Date
    Jun 2005
    Posts
    20


    Did you find this post helpful? Yes | No

    Smile Success!! (mostly)

    Hi John--

    Well, I got it working, and its working fast, solid, stable and it is a really beautiful thing! Thank you so much for your help!

    I am having one problem... I used your code as-is, and I defined a starting address before starting the loop that calls checkdmx. The problem is there's a one channel offset-- if I program in channel 5 as my target address, the device actually reads the data coming in on channel 6. If I define channel 1, it reports what's coming in on channel 2. I can't get DMX channel 1. I can't set my starting address to 0 to compensate, or when we do the subtraction that sets aminus it would underflow and seek the wrong address. What do you think is causing this? I realize I could rewrite the code to trap out this error, but since you know your code works the way you wrote it I'm wondering what could be happening here.

    I also have a question-- you determine the start code by reading RCREG right after the bit is set indicating that something came into the USART following the start break with the statement startcode = rcreg. If that's all it takes to read the start code as a valid numerical byte, why do you need to use the hserin[newlevel1] statement at all? I realize my inexperience and lack of understanding about the USART is probably why I don't get it, but I am curious.

    Thanks again for all your help, it has truly been invaluable!

    --Alan

  3. #3
    Join Date
    Nov 2004
    Posts
    61


    Did you find this post helpful? Yes | No

    Default Dmx

    Two thoughts...

    First, I made a typo when I posted the original code:

    RCREG = dummy is bad. It should be
    dummy = RCREG to clear out the buffer.

    As far as catching the early data goes, it's probably more elegant to do something like

    while x < aminus
    'wait for a byte
    'discard it
    'increment x
    WEND

    This way, if aminus = 0 and your address = 1, the trashing routine is skipped altogether.

    ...

    And you're exactly right - there's no reason why you should need to use HSERIN at all to grab the last byte. I was experimenting back and forth reading the registers and using HSERIN. Once I got it stable, I didn't change everything to match.

    So you can leave it, or change it to say

    newlevel1 = RCREG

    Either way, it should work fine.

    Curious - what are you building?

    John

  4. #4
    Join Date
    Jun 2005
    Posts
    20


    Did you find this post helpful? Yes | No

    Default DMX Continued

    Hi John--

    I tried the While:wend loop you recommended to compensate for the adrress offset, but it didn't fix it... what DID fix it was getting rid of the HSERIN command-- when I changed that to newlevel1 = rcreg, it zeroed in on the correct address! I'm wondering if the HSERIN statement has some overhead that causes it to miss that first target byte?

    Regarding what I'm building, I replied to you offlist, so look for a message there.

    Thanks again--

    --Alan

    PS: Are there any gotchas if I want to use the USART to transmit DMX?

Similar Threads

  1. DMX receive issue
    By NoahLD in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th August 2014, 13:51
  2. Simple 4 channel DMX controller
    By eggman in forum Code Examples
    Replies: 19
    Last Post: - 18th July 2012, 01:40
  3. Dmx
    By electronicsuk in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th November 2008, 07:56
  4. Big Problem in PBP To receive DMX
    By programmer07 in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 4th March 2007, 18:49
  5. DMX & PicBasic coding problem
    By magicmarty in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th September 2004, 15:35

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts