CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Sending DMX ?

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
psavolai



Joined: 04 Jun 2005
Posts: 1

View user's profile Send private message Visit poster's website

Sending DMX ?
PostPosted: Sat Jun 04, 2005 8:25 am     Reply with quote

Hi ,

I'd like to build a device that reads midi and sends DMX.
I have the midi portion already working, but felt a little
unsure after reading the DMX spec.

any tips ?

Petri.
Jean - Pierre
Guest







DMX 512
PostPosted: Sat Jun 04, 2005 8:56 am     Reply with quote

Hello,

Very Happy

Can you explain your problem with the DMW protocol ?

Jean - Pierre
dyeatman



Joined: 06 Sep 2003
Posts: 1934
Location: Norman, OK

View user's profile Send private message

PostPosted: Sat Jun 04, 2005 9:15 am     Reply with quote

..

Last edited by dyeatman on Wed Aug 04, 2010 6:03 am; edited 1 time in total
Mark



Joined: 07 Sep 2003
Posts: 2838
Location: Atlanta, GA

View user's profile Send private message Send e-mail

PostPosted: Sat Jun 04, 2005 10:02 am     Reply with quote

He wants to transmit DMX and not receive it. Here are some snippets to help get you started. They were cut and pastes and they were not compiled and they are not complete but should get you started.

Code:

#INT_TBE
void Tx_Data(void)
{
  static UINT8 tx_index = 0;

  TXREG = levels[tx_index];
   tx_index++;
  if (tx_index >= MAX_LEVELS)
  {
    /* Disable the interrupt if we are done transmitting */
    bit_clear(PIE1, TXIE);
    tx_index = 0;
    Send_Break = TRUE;
  }
}




In the main loop
Code:

#fuses HS, WDT, NOPROTECT, PUT, BROWNOUT
#ZERO_RAM
#define  CLOCK_FREQUENCY         20000000
#USE DELAY(CLOCK = CLOCK_FREQUENCY)

#define RS485_TRANSMIT_DISABLE()  bit_clear(PORTC,5)
#define RS485_TRANSMIT_ENABLE()   bit_set(PORTC,5)

BIT Send_Break = TRUE;         
BIT Send_Start_Code = FALSE;

#define MAX_LEVELS 80
int8 levels[MAX_LEVELS];    /* current levels - 0 to 255 */

void main(void)
{
  /*** setup UART - See Chapter 12 in Data Book ***/
  /* 250K bps - Refer to table 12-5 in PIC data book */
  SPBRG = 4;
  /* high speed baud rate generator */
  bit_set(TXSTA,BRGH);
  /* select async mode */
  bit_clear(TXSTA,SYNC);
  /* serial port disable */
  bit_clear(RCSTA,SPEN);
  /* disable the transmit */
  bit_clear(TXSTA,TXEN);
  /* transmit interrupt disable */
  bit_clear(PIE1, TXIE);

  /* receive interrupt disable */
  bit_clear(PIE1, RCIE);
  /* continuous receive enable */
  bit_set(RCSTA, CREN);
  /* since we are using RS485,
     we need to explicitly say
     transmit enable or not */
  RS485_TRANSMIT_DISABLE();


  while(1)
  {
    /* See if it is time to send the break signal and also make sure
        that we are done sending the last data byte. */
    if (Send_Break && bit_test(TXSTA, TRMT))
    {
      RS485_TRANSMIT_ENABLE();
      /* serial port disable */
      bit_clear(RCSTA,SPEN);
 
      bit_clear(PORTC, 0x06);
      /* 88us break signal */
      delay_us(88);
      Send_Break = FALSE;
    }
    else if (Send_Start_Code)
    {
      Send_Start_Code = FALSE;
      delay_us(3);

      /* Send start code */
      TXREG = 0;
 
      /* serial port enable */
      bit_set(RCSTA,SPEN);

     /* Transmit nine data bits, one is used for the stop bit */
      bit_set(TXSTA,TX9D);
      bit_set(TXSTA,TX9);

      /* Start transmission */
      bit_set(TXSTA,TXEN);
      bit_set(PIE1, TXIE);
    }
  }
}
Cenatronics



Joined: 27 Nov 2006
Posts: 13

View user's profile Send private message

PostPosted: Wed Sep 17, 2008 4:48 am     Reply with quote

hi Mark,

Thanks for code.
"Send_Start_Code" always FALSE. How to send levels[xx] array to serial?
Could you give a simple example please?

CENA
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group