DMX512 Problem ..Schema+Code


Results 1 to 22 of 22

Threaded View

  1. #9
    Join Date
    Feb 2007
    Posts
    12


    Did you find this post helpful? Yes | No

    Default Dmx Problem

    Yes i have made some changes on it that what mister_E says
    bu i need example fr my schema to recevie data and adres from the transmitter
    stil have problem to make control my leds to intensty and to setup dmx adress...
    mister_e says that it must be 250000 baud
    i have made it here but still have problem
    CAN YOU LOOK WHERE IS MY PROBLEM :--(
    HOW TO USE hserin here?
    can you prepare it to my schematic i wii use only 3 chanel of leds to make control for intensty no more


    '******************** INCLUDE FILES **********************
    INCLUDE "modedefs.bas"
    '******************** REGISTER **********************
    DEFINE OSC 4
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    'DEFINE HSER_SPBRG 129
    DEFINE HSER_BAUD 250000
    CMCON = 7 ' Disable analog comparator

    DipAdrr VAR WORD ' for 512 adress Dip
    DipAdr_L VAR DipAdrr.Byte0
    DipAdr_H VAR DipAdrr.byte1

    DmxAdrr VAR WORD ' Adres For 512
    DmxAdr_L VAR DmxAdrr.Byte0
    DmxAdr_H VAR DmxAdrr.Byte1

    IntData VAR BYTE[4]
    DmxData VAR BYTE
    DmxChanel VAR BYTE
    DmxCom VAR BYTE

    Addr VAR BYTE
    KesmeSayac VAR BYTE ' interupt count


    Led_G VAR PORTB.0 ' Green Led
    Led_R VAR PORTB.3 ' Red Led
    Led_B VAR PORTB.7 ' Blue Led

    DipAdr0 VAR PORTA.0 ' Dip Swicht 0
    DipAdr1 VAR PORTA.1 ' Dip Swicht 1
    DipAdr2 VAR PORTA.2 ' Dip Swicht 2
    DipAdr3 VAR PORTA.3 ' Dip Swicht 3
    DipAdr4 VAR PORTA.4 ' Dip Swicht 4
    DipAdr5 VAR PORTB.4 ' Dip Swicht 5
    DipAdr6 VAR PORTB.5 ' Dip Swicht 6
    DipAdr7 VAR PORTB.6 ' Dip Swicht 7
    DipAdr8 VAR PORTA.5 ' Dip Swicht 8

    GIE VAR INTCON.7 ' Global İnterrupt Enable Bit
    PEIE VAR INTCON.6 ' Çevresel İnterrupt Enable Bit
    T0IE VAR INTCON.5 ' Timer0 İnterrupt Enable Bit
    INTE VAR INTCON.4 ' PORTB İnterrupt Enable Bit
    RBIE VAR INTCON.3 ' Up PORTB İnterrupt Enable Bit
    T0IF VAR INTCON.2 ' Timer0 Flag Bit
    INTF VAR INTCON.1 ' PORTB.0 Flag Bit
    RBIF VAR INTCON.0 ' PORTB Flag Bit

    RCIF VAR PIR1.5 ' Receiver Enable Bit
    TXIF VAR PIR1.4 ' Transmit Enable Bit

    SYNC VAR TXSTA.4 ' Usart Mode Select Bit 1=Senkron, 0= Asenkron

    SPEN VAR RCSTA.7 ' Serial Port Enable Bit
    RX9 VAR RCSTA.6 ' 9 Bit Receive Enable Bit
    SREN VAR RCSTA.5 ' Single Receive Enable Bit
    CREN VAR RCSTA.4 ' Continuous Receive Enable Bit
    ADEN VAR RCSTA.3 ' Address Detect Enable Bit
    FERR VAR RCSTA.2 ' Frame Error Bit
    OERR VAR RCSTA.1 ' Overrun Error Bit
    RX9D VAR RCSTA.0 ' 9 Bit Of Receive Bit

    TRISA.0=1 ' IN
    TRISA.1=1 ' IN
    TRISA.2=1 ' IN
    TRISA.3=1 ' IN
    TRISA.4=1 ' IN
    TRISA.5=1 ' IN

    TRISB.0=0 ' OUT
    TRISB.3=0 ' OUT
    TRISB.4=1 ' IN
    TRISB.5=1 ' IN
    TRISB.6=1 ' IN
    TRISB.7=0 ' OUT

    Addr = 0
    KesmeSayac = 0 ' interupt count = 0

    PIE1.5 =1 ' Enable USART receive interrupt
    INTCON.6 =1 ' Enable peripheral interrupt

    ON INTERRUPT GoTo DmxKesme

    Main : GoSub DipOku

    DmxAdr_L = IntData[0]
    DmxAdr_H = IntData[1]
    DmxCom = IntData[2]
    DmxChanel = IntData[3]

    IF DmxAdrr = DipAdrr Then

    IF DmxCom = "1" Then

    IF DmxChanel = "1" Then
    High Led_G
    EndIF

    IF DmxChanel = "2" Then
    High Led_G
    EndIF

    IF DmxChanel = "3" Then
    High Led_G
    EndIF

    EndIF

    IF DmxCom = "0" Then

    IF DmxChanel = "1" Then
    Low Led_G
    EndIF
    IF DmxChanel = "2" Then
    Low Led_G
    EndIF
    IF DmxChanel = "3" Then
    Low Led_G
    EndIF
    EndIF
    EndIF

    GoTo Main

    '******************** READ ADRESS**********************
    DipOku :
    DipAdrr.0 = DipAdr0
    DipAdrr.1 = DipAdr1
    DipAdrr.2 = DipAdr2
    DipAdrr.3 = DipAdr3
    DipAdrr.4 = DipAdr4
    DipAdrr.5 = DipAdr5
    DipAdrr.6 = DipAdr6
    DipAdrr.7 = DipAdr7
    DipAdrr.8 = DipAdr8
    Return
    '******************** INTERUPT**********************
    Disable INTERRUPT
    DmxKesme : DmxData = RCREG
    IntData[Addr] = DmxData
    IF Addr = 4 Then
    Addr = 0
    Else
    Addr = Addr + 1
    EndIF
    RCSTA=$90
    Resume
    Enable INTERRUPT
    End
    Last edited by programmer07; - 1st March 2007 at 01:46.

Similar Threads

  1. Loop with two motor and 2 sensors
    By MrRoboto in forum mel PIC BASIC
    Replies: 4
    Last Post: - 9th December 2008, 00:40
  2. 16f887 44 pin demo board code problem?
    By jessey in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 7th December 2008, 15:17
  3. Making Program Code Space your playground...
    By Melanie in forum Code Examples
    Replies: 15
    Last Post: - 19th July 2008, 09:26
  4. 4 Chanel Dmx512 ready assembly code to PBP ?
    By syscoder in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 22nd March 2007, 00:55
  5. Code problem
    By chai98a in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 20th May 2006, 05:43

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