欧美极品高清xxxxhd,国产日产欧美最新,无码AV国产东京热AV无码,国产精品人与动性XXX,国产传媒亚洲综合一区二区,四库影院永久国产精品,毛片免费免费高清视频,福利所导航夜趣136

標題: 求助單片機+LCD12864成年歷設置時出現問題 [打印本頁]

作者: xxw369    時間: 2021-7-24 10:34
標題: 求助單片機+LCD12864成年歷設置時出現問題
void SetTime(uint8 count)
{
        int8 address,settime;
        int8 max,min;
        if(count < 7)
        {
                LcdDisplay12864(0,3,"設置");
        }
        if(count == 0)
        {
                address = 0x8d;max = 99;min = 0;
        }
        if(count == 1)
        {
                address = 0x89;max = 12;min = 1;
        }
        if(count == 2)
        {
                address = 0x87;max = 31;min = 0;
        }
        if(count == 3)
        {
                address = 0x85;max = 23;min = 0;
        }
        if(count == 4)
        {
                address = 0x83;max = 59;min = 0;
        }
        if(count == 5)
        {
                address = 0x81;max = 59;min = 0;
        }        
        if(count == 6)
        {
                address = 0x8b;max = 7;min = 0;
        }        
        
        settime = DS1302SingleRead(address);
        settime = (settime/16)*10 +settime%16;
        
        if(key2 == 0)
        {
                ConfigTimer0(10);
                if(key2 == 0)
                {
                        settime++;
                }
        }
        if(key3 == 0)
        {
                ConfigTimer0(10);
                if(key3 == 0)
                {
                        settime--;
                }
        }
        if(settime > max)
                settime = min;
        if(settime < min)
                settime = max;
        DS1302SingleWrite(7,0x00);
        settime = (settime/10)*16 + settime%10;
        DS1302SingleWrite(address - 1,settime);
        RefreshDate();
        RefreshTime();
}

void key(void)
{
        if(key1 == 0)
        {
                ConfigTimer0(10);
                if(key1 == 0 && w == 0)
                {
                        w = 1;
                        SetTime(setIndex);
                }
                if(key1 == 0 && w == 1)
                {
                        setIndex++;
                        if(setIndex == 7)
                        {
                                setIndex = 0;
                                LcdWriteCmd(0x0c);
                        }
                        SetTime(setIndex);                        
                }
                while(key1 == 0);
        }
        switch(setIndex)
        {
                case 0:LcdWriteCmd(0x0f);LcdWriteCmd(0x81);break;
                case 1:LcdWriteCmd(0x0f);LcdWriteCmd(0x83);break;
                case 2:LcdWriteCmd(0x0f);LcdWriteCmd(0x85);break;
                case 3:LcdWriteCmd(0x0f);LcdWriteCmd(0x90);break;
                case 4:LcdWriteCmd(0x0f);LcdWriteCmd(0x91);break;
                case 5:LcdWriteCmd(0x0f);LcdWriteCmd(0x93);break;
                case 6:LcdWriteCmd(0x0f);LcdWriteCmd(0x9a);break;
                //case 8:LcdWriteCmd(0x0f);LcdWriteCmd(0x92);break;
                //case 9:LcdWriteCmd(0x0f);LcdWriteCmd(0x9a);break;
                //case 10:LcdWriteCmd(0x0f);LcdWriteCmd(0x92);break;
                //case 11:LcdWriteCmd(0x0f);LcdWriteCmd(0x94);break;
                //case 12:LcdWriteCmd(0x0f);LcdWriteCmd(0x8b);break;
        }
        if(key4 == 0)
        {
                ConfigTimer0(10);
                if(key4 == 0 && w == 1)
                {
                        w = 0;
                        setIndex = 0;
                }
                while(key4 == 0);
        }
        if(key2 == 0)
        {
                ConfigTimer0(10);
                if(key2 == 0 && w == 1)
                {
                        SetTime(setIndex);
                }
                while(key2 == 0);
        }
        if(key3 == 0)
        {
                ConfigTimer0(10);
                if(key3 == 0 && w == 1)
                {
                        SetTime(setIndex);
                }
                while(key3 == 0);
        }
}
應該是這段程序出現的問題,但沒有找出來。麻煩高手給看看。謝謝。

時鐘.rar

80.92 KB, 下載次數: 3


作者: yzwzfyz    時間: 2021-7-24 15:18
出的什么問題呢?
作者: xxw369    時間: 2021-7-24 21:00
本帖最后由 xxw369 于 2021-7-24 21:19 編輯
yzwzfyz 發表于 2021-7-24 15:18
出的什么問題呢?

調日期數字只能變兩下,而且光標位置不對




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