標(biāo)題: 問問怎么不能使其靜態(tài)數(shù)碼從1-9點亮 [打印本頁]

作者: 嚴(yán)yan豆豆    時間: 2018-5-2 19:31
標(biāo)題: 問問怎么不能使其靜態(tài)數(shù)碼從1-9點亮
#include"reg51.h"
#include"intrins.h"
#define GPIO_DIG P0
unsigned char l=0;
void Delay100ms();
unsigned char code DIG_CODE[10]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
void main(void)
{
        while(1)
        {
                GPIO_DIG=~DIG_CODE[1];
                l++;
                if (l==1)        l=0;
                Delay100ms();
        }                                          
}
void Delay100ms()               
{
        unsigned char i, j, k;

        _nop_();
        _nop_();
        i = 5;
        j = 52;
        k = 195;
        do
        {
                do
                {
                        while (--k);
                } while (--j);
        } while (--i);
}


作者: HC6800-ES-V2.0    時間: 2018-5-3 08:41
你是抄的程序吧?!小寫的L與數(shù)字1你看不清,而出現(xiàn)錯誤。(以后自己編程,最好不要用這樣的分不清的符號)
第11行,將方括號內(nèi)的數(shù)字1改為小寫L(怕你再看不清,所以這樣寫)
第13行,將數(shù)字1改為數(shù)字10




歡迎光臨 (http://www.torrancerestoration.com/bbs/) Powered by Discuz! X3.1