Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
06/09/03 22:21
Read: times


 
#47947 - DMX512. generatin routine
Hi all,
I have tried to make an DMX512 signal like this:
- set up a timer to 100 us while the signal line is low
- when this timer overflows, keep the line high for about 8 us (MAB), and then send a 0x00 trough the line.
- then in the serial interrupt routine send the values for each channel when the TI flag get set.

but it doesnt work... so if anyone have could help... here is my source:

.equ TP0_H, 0xFF ; timer constats
.equ TP0_L, 0x74
.equ TP1_H, 0xFD
.equ TP1_L, 0x66

.equ TABLE, 0x20 ; 10 bytes table for chan values

Init:
setb TXD

mov PSW, #0x00
mov TCON, #0x00
mov PCON, #0x00 ; 250Kb baud (16 Mhz XTAL)
mov SCON, #0x98 ; serial mode 2
mov TMOD, #0x01 ; Timer 0 = 16 bits
mov TL0, #TP0_L
mov TH0, #TP0_H
mov IP, #0x02
mov IE, #0x90



Start:
mov SP, #0x40
acall Init

clr TXD
setb TR0
Loop:

; prog here
ljmp Loop

;-----------------------------------------
; Int for Timer 0 - sends Break & MAB
;-----------------------------------------
T0Int:
push acc
push psw
push 0x00

mov a, STP
jnz Passo2
mov TL0, #TP1_L
mov TH0, #TP1_H
mov r0, #6
setb TXD ; MAB
waitMAB:djnz r0, waitMAB
mov SBUF, #0x00
sjmp T0IFim

Passo2:
clr STP
clr TXD
mov TL0, #TP0_L
mov TH0, #TP0_H

T0IFim:
pop 0x00
pop psw
pop acc
reti

;-----------------------------------------
; Rotina de interrup‡Æo serial - envia os
; canais do sinal DMX512
;-----------------------------------------
SerInt:
push acc
push psw
jnb TI, SerIFim
clr TI
mov a, STP
cjne a, #10, SerOK
sjmp SerIFim
SerOK: inc STP
add a, #TABLE
mov r0, a
mov a, @r0
mov b, #28
mul ab
mov SBUF, a
SerIFim:
pop psw
pop acc
reti

List of 9 messages in thread
TopicAuthorDate
DMX512. generatin routine            01/01/70 00:00      
   RE: DMX512. generatin routine            01/01/70 00:00      
      RE: DMX512. generatin routine            01/01/70 00:00      
   RE: DMX512. generatin routine            01/01/70 00:00      
      RE: DMX512. generatin routine            01/01/70 00:00      
         RE: DMX512. generatin routine            01/01/70 00:00      
            RE: DMX512. generatin routine            01/01/70 00:00      
   RE: DMX512. generatin routine            01/01/70 00:00      
      RE: DMX512. generatin routine            01/01/70 00:00      

Back to Subject List