cancel
Showing results for 
Search instead for 
Did you mean: 

USB Low-Full-High Speed Peripherals

张鹏
New Contributor

BYTE TEMP;

void FX2LPSerial_Init() // initializes the registers for using Timer2 as baud rate generator for a Baud rate of 38400.
{
TMOD = (TMOD & 0x0F) | 0x20;
CKCON |= 0x10;
PCON |= 0x80 ;
EICON |= 0x80;
SCON1 = 0x50;
TH1 = 0xB2 ;
ES1 = 1;
TR1 = 1;
EA = 1;
}

void send_data(BYTE source)
{
SBUF1 = source;
while(TI1 == 0);
TI1 = 0;
}

void send_isr() interrupt 7
{
if(RI1 == 1)
{
RI1 = 0;
TEMP = SBUF1;
}
}

0 Likes
1 Solution
2 Replies