標(biāo)題: 單片機(jī)數(shù)碼管顯示0~9程序 [打印本頁]

作者: LSYIS    時間: 2023-6-18 16:55
標(biāo)題: 單片機(jī)數(shù)碼管顯示0~9程序
#include "reg51.h"
#define uchar unsigned char
#define uint unsigned int
sbit dula=P2^7;
uchar code tab[]=
{0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,0x7f,0x6f};
delay(uint t)
{
    uchar i,j;
                for(j=t;j>0;j--)
                                for(i=1000;i>0;i--);
}

void main()
{
    uchar n;
                while(1)
                {
                   for(n=0;n<10;n++)
                         {
                            P2=tab[n];
                                  dula=1;
                                  dula=0;
                                        delay(1000);
                         }
                }        
}

屏幕截圖 2023-06-18 165224.png (50.33 KB, 下載次數(shù): 58)

屏幕截圖 2023-06-18 165224.png

作者: spwlm    時間: 2023-6-21 10:31
一燈大師的突破




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