Simple 4 channel DMX controller


Results 1 to 20 of 20

Threaded View

  1. #1
    Join Date
    Oct 2007
    Location
    The Netherlands
    Posts
    45

    Default Simple 4 channel DMX controller

    Code:
    'simple 4 channel DMX controller
    'reads 4 potmeters to control 4 lights 
    '08-02-08 Kees Reedijk
    @ DEVICE PIC16F88, MCLR_OFF, HS_OSC, WDT_ON, LVP_OFF, PWRT_ON
    DEFINE  OSC 20             ' 20MHZ crystal
    DEFINE  ADC_BITS        8  ' Set number of bits
    DEFINE  ADC_CLOCK       3  ' Set clock source 
    DEFINE  ADC_SAMPLEUS    50 ' Set sampling time 
    DEFINE HSER_SPBRG 4   ' 250 KBaud 
    
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    
    RCSTA=%01010000 '9 bit data,usart disabled
    TXSTA=%01100101 'Enable transmit, BRGH=1, 9 bit data
    
    PORTA=    %00000000
    TRISA=    %00001111		
    PORTB=    %00100000
    TRISB=    %00000100
    ANSEL=    %00001111       
    CMCON=    %00000111
    
    DMX           VAR PORTB.5   'DMX output to SN75176 bus driver
    level1        VAR BYTE
    level2        VAR BYTE
    level3        VAR BYTE
    level4        VAR BYTE
    
    CLEAR
    
    loop:
        ADCIN 0,level1    'read level potmeters
        ADCIN 1,level2    
        ADCIN 2,level3    
        ADCIN 3,level4    
        LOW  DMX
        PAUSEUS 100
        HIGH DMX
        PAUSEUS 12
        RCSTA.7=1     'usart enabled
        HSEROUT [0,level1,level2,level3,level4]    
        PAUSE 10
        RCSTA.7=0     'usart disabled
    
    GOTO loop
    
    END
    
    
    
    
    
    
    Last edited by mackrackit; - 1st May 2011 at 17:57. Reason: fix HTML

Similar Threads

  1. DMX receive issue
    By NoahLD in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 27th August 2014, 13:51
  2. 4 Channel Thermostat using PID loops
    By malc-c in forum Code Examples
    Replies: 36
    Last Post: - 18th March 2013, 10:17
  3. 4 pin 4 x 4 keypad interface using pic basic pro
    By dunlao_john in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th January 2009, 05:21
  4. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  5. Simple 4 line LCD display with 18F4550
    By pic-ker in forum Code Examples
    Replies: 4
    Last Post: - 9th April 2007, 02:58

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