char rx_char() // 由串行端口接收字符进来
{
while(1)
{
if ( SCON & 0x01 ) == 0x01 ) // 判断数据接收是否准备好
{
break;
}
}
clrbit ( SCON.0 ); //清除RI标志
retrun SBUF; // 由串行端口接收数据进来
}
[@more@]来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/801031/viewspace-923102/,如需转载,请注明出处,否则将追究法律责任。
转载于:http://blog.itpub.net/801031/viewspace-923102/