|
|
View previous topic :: View next topic |
Author |
Message |
psavolai
Joined: 04 Jun 2005 Posts: 1
|
Sending DMX ? |
Posted: Sat Jun 04, 2005 8:25 am |
|
|
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 |
Posted: Sat Jun 04, 2005 8:56 am |
|
|
Hello,
Can you explain your problem with the DMW protocol ?
Jean - Pierre |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
|
Posted: Sat Jun 04, 2005 9:15 am |
|
|
..
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
|
|
Posted: Sat Jun 04, 2005 10:02 am |
|
|
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
|
|
Posted: Wed Sep 17, 2008 4:48 am |
|
|
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 |
|
|
|
|
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
|