??? 06/08/06 00:51 Read: times |
#117992 - First results Responding to: ???'s previous message |
Thanks Philip and Grant
Problem is definitely not BAUD RATE. I manage to sent simple MIDI message correctly, but receive problem persists. HERE IS WORKING MIDI OUT CODE: #include <reg52.h> #define uchar unsigned char void wait(uint i) { while(i--); } void Init (void) { TMOD = 0x20; TL1 = 0xff; TH1 = 0xff; TCON = 0x50; SCON = 0x70; TR1 =1; } void main (void) { Init(); while(1) { SBUF=0x90; while(!TI); TI=0; SBUF=0x30; while(!TI); TI=0; SBUF=0x64; while(!TI); TI=0; wait(60000); } } This code will send midi note on periodicaly ( 90h 30h 64h ) on 8051(52) derivative with 12 Mhz XTAL. TX is directly connected to MIDI IN. HERE IS NON WORKING MIDI LOOPBACK CODE: #include <reg52.h> #define uchar unsigned char void Init (void) { TMOD = 0x20; TL1 = 0xff; TH1 = 0xff; TCON = 0x50; SCON = 0x70; TR1 =1; ES=1; EA=1; } void main (void) { Init(); while(1); } void serial_IT(void) interrupt 4 { uchar echo; if(RI) { echo=SBUF; RI=0; SBUF=echo; while(!TI); TI=0; } } The result of this code is when midi note On message is sent from MIDIOX on midi input appears four bytes ( 00h 00h 00h FEh), and for midi Off mesage returned result is (00h 00h 00h) this FEh byte was byte i detected with previous code, on P2 as last received byte on RX Hardware before RX input is Optoisolator with pullup resistor, start bit is fallig edge, i can not see what is wrong. Until some new results, thanks for consrtuctive advices and help |