嵌入式系统原理实验课的一个问题,数码管显示结果。
extern long int result;void Main(void){ for(;;) { int str[7] = {0xfe,0xfd,0xfb,0xf7,0xef,0xdf}; int i,j,k=0,lamp=0,l=0,m=0; int ch[16] = {0xc0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8,0x80,0x90}; int c[7]; if(result >999999) { for(m=0;m<6;m++) c[m] = 0xb0; k=6; } else { while(result != 0) { int a = result % 10; result = result /10; c[k++] = ch[a]; } } while(1) { *((unsigned char *)0x10000004)=c[l++]; //数字 *((unsigned char *)0x10000006)=str[lamp++]; //灯 if(l == k) { l=0; lamp=0; } } }}
[color=#FF0000]*((unsigned char *)0x10000004)=c[l++]; //数字[/color]
[color=#FF0000]*((unsigned char *)0x10000006)=0xff; //灯[/color]*((unsigned char *)0x10000004)=c[l++]; //数字