4412芯片串口UART-----COM0配置

//uart configuartion
#define GPA0CON   (*(volatile unsigned int *)0x11400000)
#define ULCON0    (*(volatile unsigned int *)0x13800000)
#define UCON0     (*(volatile unsigned int *)0x13800004)
#define UBRDIV0   (*(volatile unsigned int *)0x13800028)
#define UFRACVAL0 (*(volatile unsigned int *)0x1380002c)
#define UTXH0     (*(volatile unsigned int *)0x13800020)
#define UTRSTAT0  (*(volatile unsigned int *)0x13800010)
#define URXH0     (*(volatile unsigned int *)0x13800024)


void uart_init()
{
    GPA0CON &= 0xffffff00;//设置引脚功能----uart模式
    GPA0CON |= 0x22;
    ULCON0 = 0x03;//设置uart通信格式,普通模式,无校验位,1位停止位,8位数据位
    UCON0 = 0x05;  //polling设置uart通信模式,中断或轮询模式
    UBRDIV0 = 53;//波特率设置
    UFRACVAL0 = 4;
}


void do_irq(void)
{
    int irq_num;
   
}


void putc(char c)
{
    while(1)


    {
        if (UTRSTAT0&0x02)//当其发送的buf为空时,跳出
            break;
    }
    UTXH0 = c;//为发送寄存器装值
  
}


void delays1(int time)
{
int i = 0,j = 0;
while(time--)
{
for(i=0;i<5;i++)
for(j=0;j<514;j++);
}
}


int main(void)
{  
    uart_init();
    while(1)
    {
        putc('a');
        delays1(15);
    }
    return;
}
   
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

屁小猪

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值