| ??? 03/31/09 01:03 Modified: 03/31/09 01:21 Read: times |
#164031 - Crystal seens OK - Could receive Midi.. "partially" send DMX Responding to: ???'s previous message |
Hi again...
I think my crystal Calculation is right: For Timer 1: 256 - ( ( 24000000 / 384 ) / 31250 ) = 254 For Timer 2: 256 - ( ( 24000000 / 32 ) / 250000 ) = 253 Kai, there arent close enough value... its just the perfect value... luckly! I could receive MIDI with no problem. I think, my major problem now is sending DMX... I dont have a comercial DMX receiver device to test, so, I'm working blind. I have a Kathy's DMX receiver mounted here... and works with it. But, I'm in doubt if a comercial DMX device will work. Some web pages says DMX have 2 start bits (or a start bit with 8mS) other says just one start bit (4 mS) Two stop bits, would be really good if just waiting 4 mS after sending a byte solves. Here is what I'm using to send the DMX, with 24mhz crystal and 8 bit serial:
RUN:
;
;...
;
CLR TXD
MOV TEMP,#190 ;Break
DJNZ TEMP,$
SETB TXD
SETB TB8
MOV SBUF,#0 ;SC
JNB TI,$
CLR TI
nop
nop
nop
nop
nop
nop
nop
MOV R0,#127
BYTESLOOP:
INC R0
SETB TB8
MOV SBUF,@R0
JNB TI,$
CLR TI
nop
nop
nop
nop
nop
nop
nop
CJNE R0,#255,BYTESLOOP
JMP RUN
I Think SETB TB8 does nothing when using 8bit serial, just forgot to remove, there's some problem? Also, please, if someone could answer this, would be very instructive for me: I never worked with dual baud rates, and duplex mode, how should I make the ISR routine? When should I clear TI and RI? In example, will have an interruption for TI while a RI interruption is running? What happens when a TI ISR is running then a RI arrives (vice versa)? There is some problem if during RI ISR I send a byte by serial (MOV Sbuf,...)? (being TX idle of course) Thanks. |



