⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 function.h

📁 三星44BO的开发板,uart驱动程序
💻 H
字号:
#include "44b0.h"


void delay(int time) //延时子程序
{
  int i;
  for(;time>0;time--)
    for(i=1000;i>0;i--);
}

void port_init() //配置端口程序
{
  //GPE5~BEEP
  
  rPDATE&=0xDF;//PE5配置为输出口,且初始值为0,使能上拉
  rPCONE=0x428;//PE5配置为输出,PE1,PE2配置为串口
  rPCONE=(rPCONE&0x3FBEB)|0x828;
 }
 
 
void bell()
{
  rPDATE|=0x20;  //使能BELL
  delay(1000);
  rPDATE&=0xDF;
}

void uart_init(int baud)
{
  rUFCON0=0x0;
  rUMCON0=0x0;
  rULCON0=0x3;
  rUCON0=0x245;
  
  rUBRDIV0=((int)(MCLK/16./baud+0.5)-1);
 }

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -