DMX receive issue


Results 1 to 6 of 6

Threaded View

  1. #1
    Join Date
    Jul 2009
    Posts
    2

    Default DMX receive issue

    I consider myself a newbie with PIC programming but have been using dmx devices for years. It's now time to try and build my own. I have done a few projects with microcontrollers but most of my projects have been stand alone PWM and ADC projects.
    I've got my USITT /ESTA DMX info book and code that sort of works.
    I'm just trying to receive the data and look at it on my serial display. For now, I'm just trying to receive channel one. I'll graduate up to counters and dip switches later.
    When I receive the data, the numbers come in correct until I get to 3%, then it hangs up but recovers at 5%. Then it hangs up from 14% on up to 19. There are other places that it hangs up all the way up to 100.
    I have tested my controller (A Swisson DMX tester) and looked at it on my scope.
    It gets weirder. When I take channel two up to 4% (not 1,2,or 3, just 4 and some other numbers above that) the code works perfectly for channel one.
    Timing issue?
    Missing break detection?
    Thanks for your help...........
    Here's my code:

    It's on a 16F876A


    Code:
     '****************************************************************
    '*  Name    : DMX21LCD.BAS                                      *
    '*  Author  : Noah Davis                                        *
    '*  Notice  : Copyright (c) 2009                                *
    '*          : All Rights Reserved                               *
    '*  Date    : 7/28/2009                                         *
    '*  Version : 21.0                                               *
    '*  Notes   :                                                   *
    '*          :                                                   *
    '****************************************************************
    init:
    
        DEFINE OSC 20
        Include "modedefs.bas"
    
    
        DEFINE CHAR_PACING 1000 
        define HSER_TXSTA 24H 
        DEFINE HSER_BAUD 250000
        DEFINE HSER_CLROERR 1
        TXSTA.2 = 1 'brgh = 0  1= high speed   
        SPBRG = 4  
      
        Symbol DmxIn = PORTC.7
        Symbol TestLed = PORTA.0
        
        counter var byte
        BreakDet var word
        dummy var word
        startcode var byte
        newlevel1 var byte
        ADCON1 =%00000111           'Turns the A/D converters to digital 
        
    main:
        
        
        pulsin DmxIn,0,BreakDet     'measure the break
        if breakdet < 40 then main  'if break is less than 80uS then try again
        dummy = RCREG
        dummy = RCREG
        RCSTA.7 = 1  'sets SPEN
        RCSTA.4 = 0 'Clear CREN
        RCSTA.4 = 1 'Sets CREN
        while PIR1.5 = 0 'wait for USART receive flag   
        wend
        startcode = RCREG 'that lovely 0 start code
        while PIR1.5 = 0    'wait for channel one
        wend
        newlevel1 = RCREG   ' my data
        RCSTA.7 = 0         'shut off the USART
        RCSTA.4 = 0 'Clear CREN
        Gosub SendCommand   
        goto main
        
        SendCommand:
        serout PORTC.6,T9600,[$FE,$01] ' clear the screen
        Serout PORTC.6,T9600,[#newlevel1] 'send data to screen
        return
    Last edited by NoahLD; - 29th July 2009 at 03:16. Reason: Forgot something

Similar Threads

  1. Simple 4 channel DMX controller
    By eggman in forum Code Examples
    Replies: 19
    Last Post: - 18th July 2012, 01:40
  2. Dmx
    By electronicsuk in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 15th November 2008, 07:56
  3. DMX on 250000 baud receive
    By syscoder in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 19th November 2007, 09:50
  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. 18F1320 ... Strange Memory
    By Acetronics2 in forum mel PIC BASIC Pro
    Replies: 43
    Last Post: - 9th April 2006, 09:55

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