如题所述
第1个回答 2015-11-18
#include <reg51.h>
unsigned char const DISP_TAB[17] = {
// 0 1 2 3 4 5 6 7 8 9
0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8, 0x80,0x90,
// A B C D E F
0x88,0x83, 0xC6, 0xA1,0x86, 0x8E, 0xFF};
//根据你的系统自己调节该函数
void sys_Delayms(unsigned int ms)
{
unsigned int i;
for ( ; ms>0; ms--)
for (i=0; i<7500; i++);
}
void main()
{
unsigned char i;
while(1) {
for (i=0;i<4;i++) {
P2 |= 0x0F;
P0 = DISP_TAB[i+1];
P2 &= ~(1 << i);
sys_Delayms(1);
}
}
}
unsigned char const DISP_TAB[17] = {
// 0 1 2 3 4 5 6 7 8 9
0xC0,0xF9,0xA4,0xB0,0x99,0x92,0x82,0xF8, 0x80,0x90,
// A B C D E F
0x88,0x83, 0xC6, 0xA1,0x86, 0x8E, 0xFF};
//根据你的系统自己调节该函数
void sys_Delayms(unsigned int ms)
{
unsigned int i;
for ( ; ms>0; ms--)
for (i=0; i<7500; i++);
}
void main()
{
unsigned char i;
while(1) {
for (i=0;i<4;i++) {
P2 |= 0x0F;
P0 = DISP_TAB[i+1];
P2 &= ~(1 << i);
sys_Delayms(1);
}
}
}
第2个回答 2015-11-18
你好!只是显示 1234,没有其他要求吗本回答被提问者采纳