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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
07/24/03 07:34
Read: times


 
#51290 - RE: Serial interrupt - code snippets
Responding to: ???'s previous message
Menno:
======
Could this be helpful? If I uncomment "TI=0" in ISR section there will be no reception - (halted?)

void Serial_in(void) interrupt 4 using 1 {
if (RI) {
RI = 0;
Ptr_Ser_Rx++;
V_Ser_Buff[Ptr_Ser_Rx]=SBUF;
//ser_putch(SBUF);
}

//if (TI) {
else {
//TI = 0;
}
}

// *********************************************
// Fungsi init serial
// **********************************************
void ser_init( unsigned char rate ) {

SCON=0x70;
TL1 =rate;
TH1 =rate;
TMOD=0x20;
PCON=0x80;
TCON=0x40;
IE =0x90;
}

// *********************************************
// Fungsi mengambil karakter ke serial
// **********************************************
unsigned char ser_getch( void ) {
while ( !RI );
RI = 0;
return SBUF;
}

// *********************************************
// Fungsi mengirim karakter ke serial
// *********************************************
void ser_putch( unsigned char ch ) { // tested & stable
SBUF = ch;
while ( !TI );
TI = 0;
}


List of 7 messages in thread
TopicAuthorDate
Serial interrupt            01/01/70 00:00      
   RE: Serial interrupt            01/01/70 00:00      
      RE: Serial interrupt - code snippets            01/01/70 00:00      
         RE: Serial interrupt - code snippets            01/01/70 00:00      
   RE: Serial interrupt            01/01/70 00:00      
      RE: Serial interrupt            01/01/70 00:00      
         RE: Serial interrupt            01/01/70 00:00      

Back to Subject List