EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 447

Default Icon
901 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
STC8A8K64D4 Series Manual
- 431 -
S2CON &= ~(1<<7); //8-bit data, 1 start bit, 1 stop bit, no checking
IE2 |= 1; //enable interrupt
S2CON |= (1<<4); //enable recieving
P_SW2 &= ~0x01;
// P_SW2 |= 1; //UART2 switch to: 0: P1.0/P1.1, 1: P4.6/P4.7
B_TX2_Busy = 0;
TX2_Cnt = 0;
RX2_Cnt = 0;
}
}
//========================================================================
// function: void UART1_int (void) interrupt UART1_VECTOR
// description: UART1 interrupt function
// parameters: nine.
// return: none.
// version: VER1.0
// date: 2014-11-28
// remark:
//========================================================================
void UART1_int (void) interrupt 4
{
if(RI)
{
RI = 0;
if(RX1_Cnt >= UART1_BUF_LENGTH) RX1_Cnt = 0;
RX1_Buffer[RX1_Cnt] = SBUF;
RX1_Cnt++;
RX1_TimeOut = 5;
}
if(TI)
{
TI = 0;
B_TX1_Busy = 0;
}
}
//========================================================================
// function: void UART2_int (void) interrupt UART2_VECTOR
// description: UART2 interrupt function
// parameters: nine.
// return: none.
// version: VER1.0
// date: 2014-11-28
// remark:
//========================================================================
void UART2_int (void) interrupt 8
{
if((S2CON & 1) != 0)
{
S2CON &= ~1; //Clear Rx flag
if(RX2_Cnt >= UART2_BUF_LENGTH) RX2_Cnt = 0;
RX2_Buffer[RX2_Cnt] = S2BUF;
RX2_Cnt++;
RX2_TimeOut = 5;
}

Table of Contents

Related product manuals