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

技術(shù)熱線: 4007-888-234

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

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

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

技術(shù)支持

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

更新時(shí)間: 2019-03-23

十年專注單片機(jī)方案開發(fā)的方案公司英銳恩,分享PIC單片機(jī)開發(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ù)上下對比值
                               // //   時(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ò),侵刪)


404
返回首頁 |  返回上一頁
上杭县| 遂昌县| 榆林市| 罗山县| 行唐县| 米泉市| 恩平市| 临泽县| 龙井市| 镇安县| 田阳县| 庆安县| 克什克腾旗| 西峡县| 平塘县| 同江市| 郧西县| 始兴县| 潜江市| 安溪县| 抚州市| 金昌市| 山阳县| 开封县| 长武县| 个旧市| 黄石市| 宁河县| 左权县| 安义县| 贵港市| 郁南县| 青冈县| 顺平县| 永嘉县| 夏津县| 化德县| 汝南县| 湟源县| 隆子县| 嵊泗县|