<strong id="0toem"><dl id="0toem"></dl></strong><b id="0toem"><menuitem id="0toem"></menuitem></b>

      <b id="0toem"><menuitem id="0toem"></menuitem></b>
    1. <code id="0toem"><abbr id="0toem"></abbr></code>
      <strong id="0toem"><dl id="0toem"></dl></strong>
      <kbd id="0toem"></kbd>
              1. <code id="0toem"></code>
                <th id="0toem"><progress id="0toem"></progress></th><strong id="0toem"><form id="0toem"></form></strong>

                <th id="0toem"></th>
              2. 131 1300 0010
                其他
                當前位置: 首頁>> 元件技術(shù)>>其他>>
              3. 導航欄目
              4. 二極管
              5. 整流橋
              6. MOS管
              7. 其他
              8. AT89S51單片機00-59秒計時器設(shè)計
                AT89S51單片機00-59秒計時器設(shè)計
              9. AT89S51單片機00-59秒計時器設(shè)計
              10.   發(fā)布日期: 2019-08-09  瀏覽次數(shù): 1,590

                1. 如下圖所示,在AT89S51單片機的P0和P2端口分別接有兩個共陰數(shù)碼管,P0口驅(qū)動顯示秒時間的十位,而P2口驅(qū)動顯示秒時間的個位。

                2. 電路原理圖

                 

                AT89S51單片機00-59秒計時器設(shè)計

                圖4.11.1

                3. 系統(tǒng)板上硬件連線

                (1. 把“單片機系統(tǒng)”區(qū)域中的P0.0/AD0-P0.7/AD7端口用8芯排線連接到“四路靜態(tài)數(shù)碼顯示模塊”區(qū)域中的任一個a-h端口上;要求:P0.0/AD0對應(yīng)著a,P0.1/AD1對應(yīng)著b,……,P0.7/AD7對應(yīng)著h。

                (2. 把“單片機系統(tǒng)”區(qū)域中的P2.0/A8-P2.7/A15端口用8芯排線連接到“四路靜態(tài)數(shù)碼顯示模塊”區(qū)域中的任一個a-h端口上;要求:P2.0/A8對應(yīng)著a,P2.1/A9對應(yīng)著b,……,P2.7/A15對應(yīng)著h。

                4. 程序設(shè)計內(nèi)容

                (1. 在設(shè)計過程中我們用一個存儲單元作為秒計數(shù)單元,當一秒鐘到來時,就讓秒計數(shù)單元加1,當秒計數(shù)達到60時,就自動返回到0,從新秒計數(shù)。

                (2. 對于秒計數(shù)單元中的數(shù)據(jù)要把它十位數(shù)和個數(shù)分開,方法仍采用對10整除和對10求余。

                (3. 在數(shù)碼上顯示,仍通過查表的方式完成。

                (4. 一秒時間的產(chǎn)生在這里我們采用軟件精確延時的方法來完成,經(jīng)過精確計算得到1秒時間為1.002秒。

                DELY1S: MOV R5,#100

                D2: MOV R6,#20

                D1: MOV R7,#248

                DJNZ R7,$

                DJNZ R6,D1

                AT89S51單片機00-59秒計時器設(shè)計

                DJNZ R5,D2

                RET

                5. 程序框圖

                圖4.11.2

                6. 匯編源程序

                Second EQU 30H

                ORG 0

                START: MOV Second,#00H

                NEXT: MOV A,Second

                MOV B,#10

                DIV AB

                MOV DPTR,#TABLE

                MOVC A,@A+DPTR

                MOV P0,A

                MOV A,B

                MOVC A,@A+DPTR

                MOV P2,A

                LCALL DELY1S

                INC Second

                MOV A,Second

                CJNE A,#60,NEXT

                LJMP START

                DELY1S: MOV R5,#100

                D2: MOV R6,#20

                D1: MOV R7,#248

                DJNZ R7,$

                DJNZ R6,D1

                DJNZ R5,D2

                RET

                TABLE: DB 3FH,06H,5BH,4FH,66H,6DH,7DH,07H,7FH,6FH

                END

                7. C語言源程序

                #include

                unsigned char code table[]={0x3f,0x06,0x5b,0x4f,0x66,

                0x6d,0x7d,0x07,0x7f,0x6f};

                unsigned char Second;

                void delay1s(void)

                {

                unsigned char i,j,k;

                for(k=100;k》0;k--)

                for(i=20;i》0;i--)

                for(j=248;j》0;j--);

                }

                void main(void)

                {

                Second=0;

                P0=table[Second/10];

                P2=table[Second%10];

                while(1)

                {

                delay1s();

                Second++;

                if(Second==60)

                {

                Second=0;

                }

                P0=table[Second/10];

                P2=table[Second%10];

                }

                }


              11. ·上一篇:
                ·下一篇:
              12. 其他關(guān)聯(lián)資訊
                深圳市日月辰科技有限公司
                地址:深圳市寶安區(qū)松崗鎮(zhèn)潭頭第二工業(yè)城A區(qū)27棟3樓
                電話:0755-2955 6626
                傳真:0755-2978 1585
                手機:131 1300 0010
                郵箱:[email protected]

                深圳市日月辰科技有限公司 版權(quán)所有:Copyright?2010-2023 www.xydibang.com 電話:13113000010 粵ICP備2021111333號
                <strong id="0toem"><dl id="0toem"></dl></strong><b id="0toem"><menuitem id="0toem"></menuitem></b>

                    <b id="0toem"><menuitem id="0toem"></menuitem></b>
                  1. <code id="0toem"><abbr id="0toem"></abbr></code>
                    <strong id="0toem"><dl id="0toem"></dl></strong>
                    <kbd id="0toem"></kbd>
                            1. <code id="0toem"></code>
                              <th id="0toem"><progress id="0toem"></progress></th><strong id="0toem"><form id="0toem"></form></strong>

                              <th id="0toem"></th>
                            2. 一级特黄AA片 | 久久婷婷在线视频 | 日本高清视频在线 | 亚洲国产成人无码a在线播放 | 亚洲一区二区电影网站 |