Topic : Serial 1 interrupt with Timer 1

Forum : 8051

Original Post
Post Information Post
November 13, 2007 - 1:14am
Guest

Hi,

I'm trying to establish serial communication(USART1) using Timer 1 in mode 2. Serial port 1 mode is 1 with 1 start, 1 stop bit, and 8 data bits.
Baudrate that I want is 9600, and below is my basic configuration:

CKCON = 0; // 0 MOVX cycle stretch

TH1 = 0xFA;
SCON1 = 0x50; // Async mode 1, 8-bit UART, enable rcvr, TI1=1, RI1=0
TMOD &= 0x0F; // mask off timer 1
TMOD |= 0x20; // T1 at 8 bit counter with auto reload (timer 1 mode = 2)
CKCON |= 0x10; // clk / 4
EICON |= 0x80; // double serial port 1 baud rate to achieve 9600
TR1 = 1;

SM0_1 = 0; // serial port 1 mode = 1
SM1_1 = 1;
SM2_1 = 1;
REN_1 = 1; // serial port 1 Receive enable
PS1 = 1; // serial port 1 interrupt high priority

ES1 = 1; // Enable Serial 1 interrupt

Is there anything wrong with this configuration to achieve 9600 baud? I'm trying to echo what's been received through USART1, but I do not get what I sent.
Please advise. Thank you!

Replies
Post Information Post
+1
0
-1
November 14, 2007 - 3:44pm
Guest

Is there anything wrong with this configuration to achieve 9600 baud nobody can tell when the clock rate and derivative is not specified

Erik