??? 06/08/06 11:18 Read: times |
#118007 - strange behaviour Responding to: ???'s previous message |
Let's forget about interrupts for a moment.
Here is code trying to count number of bytes UART received: #include <reg52.h> #define uchar unsigned char void Init (void) { TMOD = 0x20; TL1 = 0xff; TH1 = 0xff; TCON = 0x50; SCON = 0x70; TR1 =1; } void main (void) { uchar i=0; Init(); P2=0; while(1) { if(RI) { i++; RI=0; P2=i; } } } I am sending pairs NoteOn NoteOff from MIDIOX (6 bytes) with large pause (few seconds) between the pairs. After first pair i=1; (?? 6 bytes should be received) After next pair i=4 then i=7 then i=11, ETC Note that i do not change on single NoteOn or single NoteOff Strange isn't it, unless i am missing something obvious? Thanks |