主要的项目内容来了。
首先是uart部分的设计,好比需不需要中断,时钟源怎么配置等等
我先放上uart主要的代码。
首先要初始化
uart0Init(9600,0,0,8,1)
判断得到的时间字符
INT8U *time;
time= (INT8U *)malloc(20);
while(uart0GetChar()!=NULL){
time++=uart0GetChar ();
}else{
time =NULL;
}
INT8U uart0GetChar (void)
{
UART0_MemMapPtr uartPtr = UART0_BASE_PTR;
while (!(UART0_S1_REG(uartPtr) & UART0_S1_RDRF_MASK));
return UART0_D_REG(uartPtr);
}
发送设定完成
void uart0SendString (INT8U *pucBuf)
{
while (*pucBuf != '\0') {
uart0SendChar(*pucBuf++);
}
}
最后我们在time设置部分把获得的时间字符填入
int i=0;
unsigned char tmer[20];
do{
tmer=time;
i++;
}while(time!=NULL);
uart0SendString ("ok");
free(time);
接着就是时间的模块的设置了、我会把时间设置,音乐播放在一个帖子里面完成!
|