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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 3191|回復: 4
打印 上一主題 下一主題
收起左側

按一下按鍵數碼管顯示0到F的單片機程序 求幫助

[復制鏈接]
跳轉到指定樓層
樓主
  1. #include<reg51.h>
  2. sbit k1=P1^1;
  3. unsigned int code shumaguan[16]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
  4.      0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
  5. void delay (unsigned int i)
  6. {
  7.    while(i--);

  8. }
  9. void main()  
  10.     {  
  11.       unsigned int i;
  12.    if(k1==0)
  13.   {
  14.     while(!k1)
  15.    for(i=1;i<=16;i++)
  16.     {
  17.     P0=shumaguan[i];
  18.     delay(1000);

  19.    }
  20.   }
  21.    
  22. }
復制代碼

7FE5R6@}T[PKL3L%}QDNY$F.png (43.56 KB, 下載次數: 32)

7FE5R6@}T[PKL3L%}QDNY$F.png
分享到:  QQ好友和群QQ好友和群 QQ空間QQ空間 騰訊微博騰訊微博 騰訊朋友騰訊朋友
收藏收藏 分享淘帖 頂 踩
回復

使用道具 舉報

沙發
ID:430574 發表于 2018-12-5 20:52 | 只看該作者
怎么按一下讓數字顯示1再按一下顯示2這樣到F
回復

使用道具 舉報

板凳
ID:438858 發表于 2018-12-8 14:07 | 只看該作者
#include<reg52.h>
sbit led=P1^0;
sbit key=P3^0;
sbit sw=P3^6;
void Delay10ms();
void main()
{
        unsigned char temp=0xf0;
        while(1)
        {
                if(sw==0)
                {       
                        Delay10ms();
                        if(sw==0)
                        {       
                                temp++;
                                P2=temp;
                                while(!sw);         //等待按鍵釋放       
                        }       
                }       
        }       
}
void Delay10ms()                //@11.0592MHz
{
        unsigned char i, j;

        i = 108;
        j = 145;
        do
        {
                while (--j);
        } while (--i);
}
回復

使用道具 舉報

地板
ID:442260 發表于 2018-12-8 17:23 | 只看該作者
本帖最后由 Eureka!Eureka! 于 2018-12-8 17:24 編輯
舟舟 發表于 2018-12-5 20:52
怎么按一下讓數字顯示1再按一下顯示2這樣到F
  1. #include<reg51.h>
  2. sbit k1=P1^1;
  3. unsigned char P0;
  4. unsigned int code shumaguan[16]={0x3f,0x06,0x5b,0x4f,0x66,0x6d,0x7d,0x07,
  5.      0x7f,0x6f,0x77,0x7c,0x39,0x5e,0x79,0x71};
  6. void delay(unsigned int times) //延遲1ms
  7. {
  8.         unsigned int i,j;
  9.         for(i=0;i<times;i++)
  10.         {for(j=0;j<124;j++);}
  11. }
  12. void main()
  13. {
  14.        unsigned char i;
  15.        while(1)
  16. {
  17.        if(k1==1)
  18.        {
  19.           while(k1);//k1仍在按下時間內空操作
  20.           P0=shumaguan[i];//按鍵松開瞬間執行端口賦值
復制代碼
回復

使用道具 舉報

5#
ID:442293 發表于 2018-12-8 18:14 來自觸屏版 | 只看該作者
Eureka!Eureka! 發表于 2018-12-8 17:23

動態顯示
回復

使用道具 舉報

您需要登錄后才可以回帖 登錄 | 立即注冊

本版積分規則

小黑屋|51黑電子論壇 |51黑電子論壇6群 QQ 管理員QQ:125739409;技術交流QQ群281945664

Powered by 單片機教程網

快速回復 返回頂部 返回列表