用51单片机C语言帮我写一个显示1234的程序。

如题所述

第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); 
        }
    }
}

第2个回答  2015-11-18
你好!只是显示 1234,没有其他要求吗本回答被提问者采纳

相关了解……

你可能感兴趣的内容

本站内容来自于网友发表,不代表本站立场,仅表示其个人看法,不对其真实性、正确性、有效性作任何的担保
相关事宜请发邮件给我们
© 非常风气网