中文字幕无码不卡一区二区三区_少妇被又大又粗又爽毛片久久黑人_91精品国产在热久久无毒不卡_久久久久久亚洲综合网站

技術(shù)熱線: 4007-888-234
設(shè)計(jì)開(kāi)發(fā)

專注差異化嵌入式產(chǎn)品解決方案 給智能產(chǎn)品定制注入靈魂給予生命

開(kāi)發(fā)工具

提供開(kāi)發(fā)工具、應(yīng)用測(cè)試 完善的開(kāi)發(fā)代碼案例庫(kù)分享

技術(shù)支持

從全面的產(chǎn)品導(dǎo)入到強(qiáng)大技術(shù)支援服務(wù) 全程貼心伴隨服務(wù),創(chuàng)造無(wú)限潛能!

新品推廣

提供新的芯片及解決方案,提升客戶產(chǎn)品競(jìng)爭(zhēng)力

新聞中心

提供最新的單片機(jī)資訊,行業(yè)消息以及公司新聞動(dòng)態(tài)

PIC單片機(jī)開(kāi)發(fā)鬧鐘程序

更新時(shí)間: 2019-03-23
閱讀量:1773

十年專注單片機(jī)方案開(kāi)發(fā)的方案公司英銳恩,分享PIC單片機(jī)開(kāi)發(fā)鬧鐘程序。英銳恩現(xiàn)提供服務(wù)產(chǎn)品涉及主控芯片:8位單片機(jī)、16位單片機(jī)、32位單片機(jī)及各類運(yùn)算放大器等。

#include
#include
#define uchar  unsigned char
#define uint   unsigned int
 #define  T_IOIO  TRISA1
#define  KS1    RA3
#define  KS2    RA4
#define  KS3    RA5
#define  T_CLK  RA0
#define  T_IO   RA1
#define  T_RST  RA2
#define  Fm     RC0

union {
      struct {
         unsigned b0:1;
         unsigned b1:1;
         unsigned b2:1;
         unsigned b3:1;
         unsigned b4:1;
         unsigned b5:1;
         unsigned b6:1;
         unsigned b7:1;
         }oneBit;
        unsigned char allBits;
       } myFlag;
union {
      struct {
         unsigned b0:1;
         unsigned b1:1;
         unsigned b2:1;

unsigned b3:1;
         unsigned b4:1;
         unsigned b5:1;
         unsigned b6:1;
         unsigned b7:1;
         }tpBit;
        unsigned char tpBits;
       } tp;
#define acc0 tp.tpBit.b0
#define acc7 tp.tpBit.b7
#define acc  tp.tpBits 

#define FMbit myFlag.oneBit.b2
       
const  unsigned char table[11]={ 0x0C0, 0x0F9, 0x0A4,0x0B0, 0x99, 0x92,0x82, 0x0F8,0x80,0x90,0xff};
const  unsigned char  Ds1302[] = {2, 9, 5,9};//被調(diào)整數(shù)據(jù)上下對(duì)比值
                               // //   時(shí)   分  
//////////ROM區(qū)///////////////
 uchar  BCD[4];//數(shù)據(jù)送LED的數(shù)據(jù) 暫存區(qū)
 //uchar  Reeprom[6];
 uchar   appear[8];//2送LED的數(shù)據(jù) 暫存區(qū)
 uchar   get1302[4];//從1302讀出 秒 分 時(shí) 日 月 星期 年 暫存區(qū)
 uchar  DisCash[3];//合字->1302

unsigned char temp,temp1;
//延時(shí)子程序
void delay(unsigned  int i )

  while(i--);
}
     
 void display(unsigned char x)//顯示程序
    {  
       unsigned char b,c ,i;
         i=x;
         b=0x10;
        for(c=0;c<4;c++)
         { 
      PORTB=table[ appear[i]] ;

    if(( myFlag.oneBit.b0==1)&& (c==1)) RB7=0;//點(diǎn)閃
            if(( myFlag.oneBit.b1==1)&& (c==2)) RB7=0;//點(diǎn)閃
      PORTC=(PORTC&0x0f)|b;
            CLRWDT();
      delay(300);//延時(shí)子程序
            b=b<<1;
            i=i++;
          }
       
     }

/////往1302寫入1Byte數(shù)據(jù)////////////////////////////////////////////////
void RTInputByte(uchar d)                                           ////
{                                                                   ////
    uchar i;                                                        ////
    acc = d;    // tp.tpBits//                                      ////

T_IOIO=0;                                                       ////
    for(i=8; i>0; i--)                                              ////
    {                                                               ////
      T_IO = acc0;//CARRY;//ACC0;  //*相當(dāng)于匯編中的 RRC */         ////
      T_CLK = 1;                                                    ////
      T_CLK = 0;                                                    ////
     acc = acc >> 1;                                                ////
    }                                                               ////
}                                                                   ////

///////從1302讀取1Byte數(shù)據(jù)////////////////////////                  ////
uchar RTOutputByte(void)                                            ////
{                                                                   ////
    uchar i;                                                        ////
    T_IOIO=1;                                                       ////
    for(i=8; i>0; i--)                                              ////
    {                                                               ////
      acc = acc >>1;         //*相當(dāng)于匯編中的 RRC */               ////

 acc7= T_IO;// CARRY                                           ////
      T_CLK = 1;                                                    ////
      T_CLK = 0;                                                    ////
    }                                                               ////
     return(acc);                                                   ////
}                                                                   ////
///////先寫地址,后寫命令/數(shù)據(jù)//////////////////////////            ////
void W1302(uchar ucAddr, uchar ucDa)                                ////

{                                                                   ////
    T_RST = 0;                                                      ////
    T_CLK = 0;                                                      ////
    T_RST = 1;                                                      ////
    RTInputByte(ucAddr);      // /* 地址,命令 */                   ////
    RTInputByte(ucDa);        // /* 寫1Byte數(shù)據(jù)*/                   ////
    T_CLK = 1;                                                      ////
    T_RST = 0;                                                      ////
}                                                                   ////

///////先寫地址,后讀命令/數(shù)據(jù)////////////////////////              ////
uchar R1302(uchar ucAddr)                                           ////
{                                                                   ////
    uchar ucData;                                                   ////
    T_RST = 0;                                                      ////
    T_CLK = 0;                                                      ////
    T_RST = 1;                                                      ////
    RTInputByte(ucAddr);            // /* 地址,命令 */             ////
    ucData = RTOutputByte();        // /* 讀1Byte數(shù)據(jù) */            ////
    T_CLK = 1;                                                      ////

  T_RST = 0;                                                      ////
    return(ucData);                                                 ////
}                                                                   ////
/////////向1302寫入 秒 分 時(shí) 日 月 星期 年 */////////////           ////
void Set1302(uchar *pClock ,uchar a )                                ////
{                                                                   ////
    uchar i;                                                        ////
    uchar ucAddr = a;//0x80;// 秒. 分   /0x0C0 RAM                  ////
    W1302(0x8e,0x00);           ///* 控制命令,WP=0,允許寫操作*/     ////
    for(i =3; i>0; i--)                                             ////

  {                                                               ////
      W1302(ucAddr,*pClock);    ///* 秒 分 時(shí) 日 月 星期 年 */      ////
      pClock++;                                                     ////
      ucAddr +=2;                                                   ////
    }                                                               ////
     W1302(0x8e,0x80);          // /* 控制命令,WP=1,寫保護(hù)*/        ////
}                                                                   ////
////////從1302讀出 秒 分 時(shí) 日 月 星期 年 *//////////////////       ////
void v_Get1302(unsigned char  ucCurtime[],uchar a)                  ////
{                                                                   ////
 unsigned char i;                                                   ////
 unsigned char ucAddr = a;//0x83  分 0x0C1 RAM                     ////

 for (i=0;i<2;i++)                                                  ////
   {                                                                ////
      ucCurtime[i] = R1302(ucAddr);///*格式為: 秒 分 時(shí) 日 月 星期 年 */
      ucAddr += 2;                                                  ////
   }                                                                ////
}                                                                   ////
//////////拆字子程序////////////////////////////////////////////////////
 void  bcd_bcd( uchar  x )
  {  uchar  i,b, a=1;
      i=x;
     for (b=0;b<2;b++)
     {
           appear[i]=(get1302[a]&0xf0)>>4;
           i++;
           appear[i]=get1302[a]&0x0f;
           i++;
           a--;
     }

}                                                                   ////
 ////////蜂名器//////////////////////////////////////////////////////////
void  F_m()
{    

(文源網(wǎng)絡(luò),侵刪)


天镇县| 两当县| 高唐县| 泰宁县| 顺昌县| 南陵县| 沾化县| 万源市| 临猗县| 河曲县| 鄯善县| 稻城县| 榆中县| 平和县| 海口市| 内丘县| 大宁县| 额济纳旗| 江口县| 嘉峪关市| 商城县| 莎车县| 达孜县| 中阳县| 修武县| 青铜峡市| 泰和县| 仁化县| 抚宁县| 商洛市| 独山县| 绥中县| 东乌珠穆沁旗| 乌拉特后旗| 冀州市| 涡阳县| 博野县| 广丰县| 德化县| 兴海县| 舟曲县|