#include <REGX52.H>
#include "LCD1602.h"
unsigned char TempBuffer[10];
void IntToStr(unsigned int t, unsigned char *str, unsigned char n)
{
unsigned char a[5]; char i, j;
a[0]=(t/10000)%10; //取得整數值到數組
a[1]=(t/1000)%10;
a[2]=(t/100)%10;
a[3]=(t/10)%10;
a[4]=(t/1)%10;
for(i=0; i<5; i++) //轉成ASCII碼
a[i]=a[i]+'0';
for(i=0; a[i]=='0' && i<=3; i++);
for(j=5-n; j<i; j++) //填充空格
{ *str=' '; str++; }
for(; i<5; i++)
{ *str=a[i]; str++; } //加入有效的數字
*str='\0';
}
void Dela
單片機應用系統設計技術——字符液晶1602仿真測試
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.