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

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
02/26/03 21:18
Read: times


 
#40177 - 8051 Serial UART problem
Hi folks! I wrote a small program to send a byte through the 8051 UART. But i got a problem... Everytime i send a byte to SBUF special register, the TI flag it isn“t being set. I wrote my program in C using Keil uVision2 and is shown bellow.

#include <at898252.h>

void disable_interrupts(void);
void set_timer2(void);
void set_serial(void);
void set_interrupts(void);
void send_byte(void);

void main(void){

disable_interrupts();
set_serial();
set_timer2();
set_interrupts();
send_byte();
}

void disable_interrupts(void){

IE = 0X80;
EA = 0;
}

void set_timer2(void){

RCAP2H = 0XFF;
RCAP2L = 0XDC;
T2CON = 0X34;
}

void set_serial(void){

SCON = 0x40;
TI = 0;
}

void set_interrupts(void){

IE = 0X90;
IP = 0X10;
}

void send_byte(void){

SBUF = 0X41;
}

void serial_interrupt(void) interrupt 4 using 0 {

TI=0;
}



List of 8 messages in thread
TopicAuthorDate
8051 Serial UART problem            01/01/70 00:00      
   RE: 8051 Serial UART problem            01/01/70 00:00      
   RE: 8051 Serial UART problem            01/01/70 00:00      
   RE: 8051 Serial UART problem            01/01/70 00:00      
   RE: 8051 Serial UART problem            01/01/70 00:00      
      RE: 8051 Serial UART problem            01/01/70 00:00      
         RE: 8051 Serial UART problem            01/01/70 00:00      
         RE: 8051 Serial UART problem            01/01/70 00:00      

Back to Subject List