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

標題: 四個按鍵槍聲 單片機模擬 [打印本頁]

作者: 羿羽鋒    時間: 2017-5-20 00:34
標題: 四個按鍵槍聲 單片機模擬
#include <reg52.h>
#include <intrins.h>

#define uchar unsigned char
#define uint  unsigned int

sbit  BEEP= P1^5;
sbit  K1  = P3^0;
sbit  K2  = P3^1;
sbit  K3  = P3^3;
sbit  K4  = P3^2;

uchar  H_count,L_count;

/*********************************************************/
void  main()
{        
         P0=0;
        BEEP=1;
    TMOD=0x01;
    TH0=0xff;
    TL0=0xa0;
    H_count=0xff;
    L_count=0xa0;      
    EA=1;
    ET0=1;

    while(1)
    {
     if(K1 == 0)  TR0=1;
         if(K2 == 0)  TR0=1;
         if(K3 == 0)  TR0=1;
         if(K4 == 0)  TR0=1;
    }
}

/*********************************************************

**********************************************************/
void Time0(void) interrupt 1 using 0
{
        BEEP=~BEEP;
        if( L_count!=0x00 )
        {
           L_count--;
           TH0=H_count;
       TL0=L_count;
       return;
     }else  H_count--;
               
        if( H_count!=0xfc )
        {
           L_count--;
           TH0=H_count;
       TL0=L_count;
       return;
        }
        else
     {
        H_count=0xff;
        L_count=0xa0;
        TH0=H_count;
        TL0=L_count;
        BEEP=1;
        TR0=0;
     }   
}

/*********************************************************/






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