找回密碼
 立即注冊(cè)

QQ登錄

只需一步,快速開始

搜索
查看: 2282|回復(fù): 0
收起左側(cè)

基于stc89c52按鍵數(shù)碼管計(jì)算器

[復(fù)制鏈接]
ID:410399 發(fā)表于 2018-10-16 11:08 | 顯示全部樓層 |閱讀模式
按鍵k2數(shù)碼管左邊數(shù)加一,按鍵k4書數(shù)碼管右邊數(shù)加一,按鍵k5重置,按鍵k6倆數(shù)相加,按鍵k8倆數(shù)相減

void main(void)
{
        while(1)
        {
                if(k2 == 0)
                {
                        int_delay();
                        if(k2 == 0)
                        {
                                LedNumVal1++;                               
                        }
                       
                }

                if(k4 == 0)
                {
                        int_delay();
                        if(k4 == 0)
                        {
                                LedNumVal2++;
                        }
                       
                }               
               
                if(k6 == 0)
                {
                        int_delay();
                        if(k6 == 0)
                        {
                                LedNumVal2=LedNumVal1+LedNumVal2;
                                LedNumVal1 = 0;
                        }
                       
                }       
               
                if(k8 == 0)
                {
                        int_delay();
                        if(k8 == 0)
                        {
                                if(LedNumVal1 >= LedNumVal2)
                                {
                                        LedNumVal2 = LedNumVal1-LedNumVal2;
                                        LedNumVal1 = 0;
                                }
                                else
                                {
                                        j++;
                                        LedNumVal2 = LedNumVal2-LedNumVal1;
                                        LedNumVal1 = 0;
                                }
                        }

                       
                }       


數(shù)碼管計(jì)算器.zip

36.31 KB, 下載次數(shù): 27, 下載積分: 黑幣 -5

評(píng)分

參與人數(shù) 1黑幣 +50 收起 理由
admin + 50 共享資料的黑幣獎(jiǎng)勵(lì)!

查看全部評(píng)分

回復(fù)

使用道具 舉報(bào)

本版積分規(guī)則

手機(jī)版|小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術(shù)交流QQ群281945664

Powered by 單片機(jī)教程網(wǎng)

快速回復(fù) 返回頂部 返回列表