打印
[技术问答]

RD8x3x串口

[复制链接]
110|0
手机看帖
扫描二维码
随时随地手机跟帖
跳转到指定楼层
楼主
minzisc|  楼主 | 2024-1-13 10:19 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
void delay(uint16_t nms)
{
        uint16_t i,j;
        for(i=0;i<nms;i++)
                for(j=0;j<10000;j++)
                ;
}
void Uart1_Init(unsigned int Freq,unsigned long int baud)
{
    P1CON&=0xf5;
    P1PH|=0x0A;
    OTCON|=0xc0;
    US1CON0=0x50;
    US1CON1=Freq*1000000/baud;
    US1CON2=(Freq*1000000/baud)>>8;
}

void Uart1_Send(int value)
{
    US1CON0=US1CON0&0xFD|0x02;
    US1CON3 = (uint8_t)value;
    while((US1CON0&0x02) == 0x00);
}


使用特权

评论回复
发新帖 我要提问
您需要登录后才可以回帖 登录 | 注册

本版积分规则

49

主题

5173

帖子

4

粉丝