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

 找回密碼
 立即注冊

QQ登錄

只需一步,快速開始

搜索
查看: 1418|回復: 0
收起左側

新手求教 用的IAP15轉接板,沒有一點現象

[復制鏈接]
ID:266083 發表于 2017-12-24 16:12 | 顯示全部樓層 |閱讀模式

#include <reg52.h>
#include <intrins.h>
#define key_input P3
#define key_mask 0x0f
#define key_state_0 0
#define key_state_1 1
#define key_state_2 2
typedef  unsigned char uchar ;
typedef  unsigned int uint;
uchar tab[] = {0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
uchar disbuf[] = {0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07};
sbit buzzer=P0^6;
char Key_Read(void)
{
     static char key_state=0;
     char key_press,key_return=0;
     key_press=key_mask&key_input;
     switch(key_state)
     {
            case key_state_0:
            if(key_press!=key_mask)
               key_state=key_state_1;
            break;
            case key_state_1:
            if(key_press==key_mask&key_input)
            {            
               if(key_press==0x0e)key_return=1;
               if(key_press==0x0d)key_return=2;
               if(key_press==0x0b)key_return=3;
               if(key_press==0x07)key_return=4;            
               key_state=key_state_2;   
            }
            break;
            case key_state_2:
            if(key_press==key_state_0)
            key_state=key_state_0;
            break;
     }
return key_return;
}
void Display(uchar which,uchar num)
{
     P2=0xc0;P0=0xff;P2=0x00;
     P2=0xc0;P0=disbuf[which];P2=0x00;
     P2=0xe0;P0=tab[num];P2=0x00;
}
void Time0() interrupt 1 using 3
{
     char i;
     TH0=(65536-1000)/256;
     TL0=(65536-1000)%256;
     i=Key_Read;
     if(i==1)Display(0,1);
     if(i==2)Display(7,1);
     if(i==3)buzzer=1;
     if(i==4)buzzer=0;
}
void main()
{
     TH0=(65536-1000)/256;
     TL0=(65536-1000)%256;
     ET0=0;
     TR0=1;
     EA=1;
     while(1)
     {
              ;
     }      
}



Rebuild target 'Target 1'
assembling STARTUP.A51...
compiling main.c...
linking...
Program Size: data=36.0 xdata=0 code=346
creating hex file from "一個人的寂寞"...
"一個人的寂寞" - 0 Error(s), 0 Warning(s).


用的IAP15轉接板,沒有一點現象,暈死
回復

使用道具 舉報

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

本版積分規則

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

Powered by 單片機教程網

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