串口程序求解,求各大虾指点

2019-03-23 19:56发布

void Serial3AddRecBuffer(INT8U cData,BOOLEAN bR8)
{

#if (SERIAL3RECBUFFER)
        INT16U ctemp=0,cLoc=0;
#endif

#if (SERIAL3RECBUFFER==0)
        m_cSerial3RecBuffer=cData;
        m_cSerial3BitRecBuffer=bR8;
        m_cSerial3RecNum++;
#else
        if(m_cSerial3RecNum>=SERIAL3RECBUFFER)
                return;
       
        cLoc=m_cSerial3RecPos/8;
        ctemp=1<<(m_cSerial3RecPos%8);

        m_cSerial3RecBuffer[m_cSerial3RecPos]=cData;
        m_cSerial3BitRecBuffer[cLoc]&=~ctemp;
        if(bR8)
                m_cSerial3BitRecBuffer[cLoc]|=ctemp;

        if(++m_cSerial3RecPos>=SERIAL3RECBUFFER)
            m_cSerial3RecPos=0;

        m_cSerial3RecNum++;
#endif
} 此帖出自小平头技术问答
0条回答

一周热门 更多>