这个程序是显示数字的部分,数字最大为999999,能否讲解一下for循环的思想。谢谢!
...
sbit bflag=ACC^7;
...
void lcd_disp(unsigned long s,unsigned char x,unsigned char y) { unsigned char i; unsigned int temp; unsigned char flag=0; setxy(x,y); for(i=6;i>0;i--) { temp=(s>>((i-1)*4))&0xf; if((temp!=0)||((temp==0)&&(flag==1))||((temp==0)&&(i==1))) { flag=1; lcd_char(48+temp); } } } |