EasyManua.ls Logo

STC micro STC8A8K64D4 Series - Page 442

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
- 426 -
{
delay_ms(1);
if(RX1_TimeOut > 0)
{
if(--RX1_TimeOut == 0) // If it times out, the serial port reception ends
{
if(RX1_Cnt > 0)
{
Lin_Send(RX1_Buffer); // Send the data received by UART1 to the LIN bus
}
RX1_Cnt = 0;
}
}
if(RX2_TimeOut > 0)
{
if(--RX2_TimeOut == 0) // If it times out, the serial port reception ends
{
if(RX2_Cnt > 0)
{
for (i=0; I < RX2_Cnt; i++) // End with stop 0
{
UART1_TxByte(RX2_Buffer[i]); // Send data received from LIN bus to UART1
}
}
RX2_Cnt = 0;
}
}
}
}
//========================================================================
// function: void delay_ms(unsigned char ms)
// description: delay function
// parameters: ms, number of ms to delay, only support 1~255ms, and automatically adapt to master clock.
// return: none.
// version: VER1.0
// date: 2013-4-1
// remark:
//========================================================================
void delay_ms(u8 ms)
{
u16 i;
do{
i = MAIN_Fosc / 10000;
while(--i); //10T per loop
}while(--ms);
}
//========================================================================
// function: u8 Lin_CheckPID(u8 id)
// description: The ID code plus the check character is converted into a PID code.
// parameters: IDcode.
// return: PIDcode.
// version: VER1.0
// date: 2020-12-2
// remark:
//========================================================================

Table of Contents

Related product manuals