- #include <reg52.h>
- #define uchar unsigned char
- #define uint unsigned int
- void delay_ms (uint x)
- {
- uchar t;
- while(x--)
- for(t=0; t<120; t++);
- }
- void main()
- {
- uchar i;
- unsigned char table[]=(0xc0, 0xf9, 0xa4, 0xb0, 0x99, 0x92, 0x82, 0xf8, 0x80, 0x90);
- SCON=0x00;
- while(i<10)
- {
- SBUF=table [i];
- while(!TI);
- TI=0;
- i=(i+1)%10;
- delay_ms(1000);
- }
- }
復制代碼 我的仿真只顯示8 9 沒有顯示0-9的數字 好奇怪?
|