24 lines
357 B
C
24 lines
357 B
C
|
#include "mc8051fun.h"
|
||
|
|
||
|
#include <at89c51ed2.h>
|
||
|
|
||
|
|
||
|
void uart_init_(uint8_t timer_init,uint8_t x2)
|
||
|
{
|
||
|
TMOD |= 0x20; // Timer 1 in Mode 2
|
||
|
TH1 = timer_init;
|
||
|
TL1 = timer_init;
|
||
|
TR1 = 1; // Start Timer 1
|
||
|
SCON = 0x50; // 8-bit data, 1 stop bit, REN enabled
|
||
|
|
||
|
if(x2)
|
||
|
setbits(PCON,SMOD);
|
||
|
else
|
||
|
unsetbits(PCON,SMOD);
|
||
|
|
||
|
return;
|
||
|
|
||
|
}
|
||
|
|
||
|
|