*buf 存放串口接收的數據
len 串口接收數據長度
本程序作用是根據串口第一位內容控制12864對應位置顯示,
現在問題是用PutString顯示的內容都正常,
用PutChar顯示的內容只在屏幕上閃一下就消失了
PutString(顯示字符串函數),PutChar(顯示字符函數)這兩個函數本身是好的,買開發板的時候例程里帶的,一直正常使用的
PutString也是調用PutChar顯示每個字符的,為什么我單獨使用PutChar時,顯示一下就消失了,
void xianshi (unsigned char *buf ,unsigned char len)
{
unsigned char i=0;
// CLSLcd();//這里清屏閃爍只能在后面清屏,
switch (buf[0]) //只判斷接收到的第一個數據
{
case 0x36:CLSLcd();PutString(3,29,"kai");break;//kai清屏,并將kai顯示到12864
case 0x31:CLSLcd();PutString(3,29,"guan");break;//guan清屏,并將關顯示到12864
case 0x32:CLSLcd();PutString(3,29,"zuo"); break;
case 0x33:CLSLcd();PutString(3,29,"you"); break;
case 0x34:CLSLcd();PutString(3,29,"shang");break;
case 0x35:CLSLcd();PutString(3,29,"xia"); break;
default:uartwrite("bad cmmand.\r\n",sizeof("bad cmmand.\r\n")-1);
return;//沒有對應命令,給上位機發送bad
}
for(i;i<len;i++) //將串口接收到的完整數據顯示到12864
{ PutChar(2,i*6,buf[ i]); //逐個顯示串口接收的數據到屏幕
}
PutString(0,28,"dghedftgewrft");//隨便顯示什么都正常
PutChar(4,29,len);
PutString(6,29,"ab36547HIJKLMNmn");
uartwrite(buf,len); //發送到上位機,表示已執行,*/
}
|