TQ2440之最簡串口傳輸數(shù)據(jù)
#include "2440addr.h"
#include "Option.h"
#include "def.h"
unsigned int PCLK;
extern void Uart_Printf(char *fmt,...);
extern void Uart_Init(int pclk,int baud);
extern void Port_Init(void);
extern void Uart_Select(int ch);//外部函數(shù)申明,不然一直有警告。看著不爽
void delay(void)
{
unsigned int i,j;
for(i=0;i<1000;i++)
for(j=0;j<1000;j++)
;
}
void Main(void)
{
Uart_Select(0);//選擇串口0
Port_Init();
Uart_Init(50000000,115200);//串口初始化,時(shí)鐘參數(shù)當(dāng)為0時(shí)選擇的時(shí)候PCLK為50MHz,效果一樣
Uart_Printf("nn");
delay();
while(1)
{
Uart_Printf("I love caimanjun more than myselfn"); //打印字符串
delay();
Uart_Printf("yes I do! n");
delay();
}
}
評論