1602控制forMSP430
时间:11-27
来源:互联网
点击:
- WriteData(a[i]);
- }
- /*************************************************************************
- //名称:WriteNum
- //参数:待写入数字,unsignedcharx,unsignedchary
- //返回值:无
- //功能:在给定位置显示一个数字(不超过5位且小于65536)
- *************************************************************************/
- voidWriteNum(uintn,ucharx,uchary)
- {
- ucharfive,four,three,two,one;
- LocateXY(x,y);
- if((n>=10000)&&(n<=65535))
- {
- five=n/10000;
- four=(n%10000)/1000;
- three=((n-five*10000)%1000)/100;
- two=((n-five*10000)%1000-three*100)/10;
- one=((n-five*10000)%1000-three*100)%10;
- WriteData(NUM[five]);
- WriteData(NUM[four]);
- WriteData(NUM[three]);
- WriteData(NUM[two]);
- WriteData(NUM[one]);
- }
- if((n>=1000)&&(n<=9999))
- {
- four=n/1000;
- three=(n%1000)/100;
- two=(n%1000-three*100)/10;
- one=(n%1000-three*100)%10;
- WriteData(NUM[four]);
- WriteData(NUM[three]);
- WriteData(NUM[two]);
- WriteData(NUM[one]);
- }
- if((n>=100)&&(n<=999))
- {
- three=n/100;
- two=(n-three*100)/10;
- one=(n-three*100)%10;
- WriteData(NUM[three]);
- WriteData(NUM[two]);
- WriteData(NUM[one]);
- }
- if((n>=10)&&(n<=99))
- {
- two=n/10;
- one=n%10;
- WriteData(NUM[two]);
- WriteData(NUM[one]);
- }
- if((n>0)&&(n<=9))WriteData(NUM[n]);
- }
- /*************************************************************************
- //名称:WriteFloat
- //参数:待写入浮点数,unsignedcharx,unsignedchary
- //返回值:无
- //功能:在给定位置显示一个浮点数(整数部分和小数部分都不超过两位)
- *************************************************************************/
- voidWriteFloat(floatn,ucharx,uchary)
- {
- uintInteger,Decimal;//Integer用于存放整数部分,Decimal用于存放小数部分
- Integer=(uint)(n/1);
- Decimal=(uint)(n*100-Integer*100);
- WriteNum(Integer,x,y);
- WriteData(NUM[10]);
- WriteNum(Decimal,x+3,y);
- }
1602控制MSP43 相关文章:
- Windows CE 进程、线程和内存管理(11-09)
- RedHatLinux新手入门教程(5)(11-12)
- uClinux介绍(11-09)
- openwebmailV1.60安装教学(11-12)
- Linux嵌入式系统开发平台选型探讨(11-09)
- Windows CE 进程、线程和内存管理(二)(11-09)