亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? fm24c04test.c

?? c8051f350,如何使用鐵電串行存儲器FM24C02 KEIL C 匯編多可以
?? C
?? 第 1 頁 / 共 2 頁
字號:

   // Specify the Incoming Data
   WORD_ADDR = addr;                         // Set the target address in the EEPROM's
                                             // internal memory space

   pSMB_DATA_IN = &retval;                   // The incoming data pointer points to
                                             // the <retval> variable.

   SMB_DATA_LEN = 1;                         // Specify to ISR that the next transfer
                                             // will contain one data byte

   // Initiate SMBus Transfer
   STA = 1;
   while(SMB_BUSY);                          // Wait until data is read

   return retval;

}

//------------------------------------------------------------------------------------

//------------------------------------------------------------------------------------
// Initialization Routines
//------------------------------------------------------------------------------------

//------------------------------------------------------------------------------------
// SMBus_Init()
//------------------------------------------------------------------------------------
//
// SMBus configured as follows:
// - SMBus enabled
// - Slave mode disabled
// - Timer1 used as clock source. The resulting SCL frequency will be approximately
//   1/3 the Timer1 overflow rate
// - Setup and hold time extensions enabled
// - Free and SCL low timeout detection enabled
//
void SMBus_Init (void)
{
   SMB0CF = 0x5D;                            // Use Timer1 overflows as SMBus clock
                                             // source;
                                             // Disable slave mode;
                                             // Enable setup & hold time extensions;
                                             // Enable SMBus Free timeout detect;
                                             // Enable SCL low timeout detect;

   SMB0CF |= 0x80;                           // Enable SMBus;
}

//------------------------------------------------------------------------------------
// Timer3_Init()
//------------------------------------------------------------------------------------
//
// Timer3 configured for use by the SMBus low timeout detect feature as follows:
// - Timer3 in 16-bit auto-reload mode
// - SYSCLK/12 as Timer3 clock source
// - Timer3 reload registers loaded for a 25ms overflow period
// - Timer3 pre-loaded to overflow after 25ms
// - Timer3 enabled
//
void Timer3_Init (void)
{
   TMR3CN = 0x00;                            // Timer3 configured for 16-bit 
                                             // auto-reload,
                                             // low-byte interrupt disabled

   TMR3 = -(SYSCLK/12/40);                   // Timer3 configured to overflow after
   TMR3RL = -(SYSCLK/12/40);                 // ~25ms (for SMBus low timeout detect)


   CKCON &= ~0x40;                           // Timer3 uses SYSCLK/12
   TMR3 |= 0x04;                             // Start Timer3
}

//------------------------------------------------------------------------------------
// Timer1_Init()
//------------------------------------------------------------------------------------
//
// Timer1 configured as the SMBus clock source as follows:
// - Timer1 in 8-bit auto-reload mode
// - SYSCLK / 12 as Timer1 clock source
// - Timer1 overflow rate => 3 * SMB_FREQUENCY
// - The maximum SCL clock rate will be ~1/3 the Timer1 overflow rate
// - Timer1 enabled
//
void Timer1_Init (void)
{
   CKCON &= ~0x0B;                           // Timer1 clock source = SYSCLK / 12
   TMOD = 0x20;                              // Timer1 in 8-bit auto-reload mode

   TH1 = -(SYSCLK/SMB_FREQUENCY/12/3);       // Timer1 configured to overflow at 1/3
                                             // the rate defined by SMB_FREQUENCY

   TL1 = -(SYSCLK/SMB_FREQUENCY/12/3);       // Timer1 preloaded to overflow at 1/3
                                             // the rate defined by SMB_FREQUENCY

   TR1 = 1;                                  // Timer1 enabled
}

//------------------------------------------------------------------------------------
// PORT1_Init
//------------------------------------------------------------------------------------
//

void Port1_Init (void)
{ P0SKIP    = 0x3F;
    XBR0      = 0x04;


   XBR1 = 0x40;                              // Enable crossbar and weak pull-ups

   P0MDIN = 0xFF;                            // All P0 pins digital input

   P0MDOUT = 0x00;                           // All P0 pins open-drain output
   P0 = 0x30;                               

}

//------------------------------------------------------------------------------------
// SMBus Interrupt Service Routine (ISR)
//------------------------------------------------------------------------------------
//
// SMBus ISR state machine
// - Master only implementation - no slave or arbitration states defined
// - All incoming data is written starting at the global pointer <pSMB_DATA_IN>
// - All outgoing data is read from the global pointer <pSMB_DATA_OUT>
//
void SMBus_ISR (void) interrupt 7
{
   bit FAIL = 0;                             // Used by the ISR to flag failed
                                             // transfers

   static char i;                            // Used by the ISR to count the
                                             // number of data bytes sent or
                                             // received

   static bit SEND_START = 0;                // Send a start

   switch (SMB0CN & 0xF0)                    // Status vector
   {
      // Master Transmitter/Receiver: START condition transmitted.
      case SMB_MTSTA:

         SMB0DAT = TARGET;                   // Load address of the target slave
         SMB0DAT |= SMB_RW;                  // Load R/W bit
         STA = 0;                            // Manually clear START bit
         i = 0; 

		 _nop_();                             // reset data byte counter
         break;

      // Master Transmitter: Data byte (or Slave Address) transmitted
      case SMB_MTDB:
         if (ACK)                            // Slave Address or Data Byte 
         {                                   // Acknowledged?
            if (SEND_START)
            {
               STA = 1;
               SEND_START = 0;
               break;
            }
            if(SMB_SENDWORDADDR)             // Are we sending the word address?
            {
               SMB_SENDWORDADDR = 0;         // Clear flag
               SMB0DAT = WORD_ADDR;          // send word address

               if (SMB_RANDOMREAD)
               {
                  SEND_START = 1;            // send a START after the next ACK cycle
                  SMB_RW = READ;
               }

               break;
            }

            if (SMB_RW==WRITE)               // Is this transfer a WRITE?
            {

               if (i < SMB_DATA_LEN)         // Is there data to send?
               {
                  SMB0DAT = *pSMB_DATA_OUT;  // send data byte
                  pSMB_DATA_OUT++;           // increment data out pointer
                  i++;                       // increment number of bytes sent
               }
               else
               {
                 STO = 1;                    // set STO to terminte transfer
                 SMB_BUSY = 0;               // clear software busy flag
               }
            }
            else {}                          // If this transfer is a READ,
                                             // then take no action. Slave
                                             // address was transmitted. A
                                             // separate 'case' is defined
                                             // for data byte recieved.
         }
         else                                // If slave NACK,
         {
            if(SMB_ACKPOLL)
            {
               STA = 1;                      // Restart transfer
            }
            else
            {
               FAIL = 1;                     // Indicate failed transfer
            }                                // and handle at end of ISR
         }
         break;

      // Master Receiver: byte received
      case SMB_MRDB:
         if ( i < SMB_DATA_LEN )             // Is there any data remaining?
         {
            *pSMB_DATA_IN = SMB0DAT;         // Store received byte
            pSMB_DATA_IN++;                  // Increment data in pointer
            i++;                             // Increment number of bytes received
            ACK = 1;                         // Set ACK bit (may be cleared later
                                             // in the code)

         }

         if (i == SMB_DATA_LEN)              // This is the last byte
         {
            SMB_BUSY = 0;                    // Free SMBus interface
            ACK = 0;                         // Send NACK to indicate last byte
                                             // of this transfer
            STO = 1;                         // Send STOP to terminate transfer
         }

         break;

      default:
         FAIL = 1;                           // Indicate failed transfer
                                             // and handle at end of ISR
         break;
   }

   if (FAIL)                                 // If the transfer failed,
   {
      SMB0CN &= ~0x40;                       // Reset communication
      SMB0CN |= 0x40;
      SMB_BUSY = 0;                          // Free SMBus
   }

   SI=0;                                     // clear interrupt flag
}

//------------------------------------------------------------------------------------
// Timer3 Interrupt Service Routine (ISR)
//------------------------------------------------------------------------------------
//
// A Timer3 interrupt indicates an SMBus SCL low timeout.
// The SMBus is disabled and re-enabled here
//
void Timer3_ISR (void) interrupt 14
{  
   SMB0CN &= ~0x40;                          // Disable SMBus
   SMB0CN |= 0x40;                           // Re-enable SMBus
   TMR3CN &= ~0x80;                          // Clear Timer3 interrupt-pending flag
   

}

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美精品自拍偷拍| 欧美成人性福生活免费看| 久久网站最新地址| 亚洲1区2区3区视频| 96av麻豆蜜桃一区二区| 国产亚洲人成网站| 狠狠色丁香婷综合久久| 日韩一区二区三区免费观看| 午夜a成v人精品| 91精品国产免费| 秋霞成人午夜伦在线观看| 欧美男同性恋视频网站| 日本视频在线一区| 国产婷婷一区二区| 91亚洲精品久久久蜜桃| 一区二区久久久久久| 欧美日韩免费在线视频| 奇米影视7777精品一区二区| 欧美一区二区视频免费观看| 国产一区二区三区黄视频| 欧美国产97人人爽人人喊| 97精品视频在线观看自产线路二| 亚洲欧美日韩精品久久久久| 欧洲生活片亚洲生活在线观看| 日韩主播视频在线| 国产日韩在线不卡| 欧美日韩精品一区二区三区蜜桃 | 欧美日韩精品电影| 久久成人免费网站| 国产三级精品在线| 欧美一区二视频| 欧美在线一区二区三区| 精品一区二区久久| 日韩成人一级片| 亚洲人成网站在线| 国产婷婷色一区二区三区| 欧美高清www午色夜在线视频| 日韩精品亚洲专区| 国产精品久久久久久久久免费丝袜| 成人一区二区视频| 国内成人精品2018免费看| 亚洲精品国产精华液| 91精品办公室少妇高潮对白| 久久精品久久99精品久久| 亚洲国产另类av| 成人免费视频在线观看| 欧美精品一区二区三区四区 | 粉嫩在线一区二区三区视频| 自拍偷拍国产精品| 日韩欧美激情四射| 666欧美在线视频| 91九色02白丝porn| 91老司机福利 在线| 99精品在线免费| 大白屁股一区二区视频| 五月婷婷综合激情| 亚洲福利视频导航| 亚洲一区视频在线| 国产欧美日韩中文久久| 欧美一区日本一区韩国一区| 欧美日韩一区二区三区免费看| 99re视频精品| 欧美在线观看你懂的| 欧美影视一区二区三区| 欧美网站一区二区| 欧美精品电影在线播放| 欧美日本乱大交xxxxx| 亚洲精品在线网站| 国产欧美一区二区精品忘忧草| 国产精品久久久久毛片软件| 亚洲女同ⅹxx女同tv| 午夜精品在线看| 国产精品主播直播| 色婷婷av一区二区| 欧美精品一区二区高清在线观看| 久久一日本道色综合| 亚洲男人天堂av网| 国产揄拍国内精品对白| 91在线观看成人| 欧美一区二区不卡视频| 日韩美女精品在线| 国产制服丝袜一区| 欧美体内she精高潮| 亚洲国产精品ⅴa在线观看| 天天综合日日夜夜精品| eeuss鲁片一区二区三区| 7777精品伊人久久久大香线蕉最新版| 国产午夜精品理论片a级大结局| 亚洲一区二区三区视频在线播放| 久久国产三级精品| 日韩女优制服丝袜电影| 亚洲另类春色国产| 成人av资源下载| 精品国产一区二区三区不卡| 午夜在线成人av| 欧美一区二区三区免费观看视频 | 亚洲欧美电影一区二区| 91色porny在线视频| 亚洲不卡av一区二区三区| 欧美日韩国产区一| 精品伊人久久久久7777人| 欧美一区二区精品久久911| 肉肉av福利一精品导航| 欧美va在线播放| 国v精品久久久网| 亚洲欧洲国产日本综合| 91蝌蚪porny九色| 亚洲国产裸拍裸体视频在线观看乱了 | 懂色av一区二区夜夜嗨| 亚洲五月六月丁香激情| 91精品福利在线一区二区三区| 裸体一区二区三区| 久久日韩粉嫩一区二区三区| 处破女av一区二区| 一区二区三区精品视频在线| 69堂国产成人免费视频| 国产a久久麻豆| 中文字幕中文在线不卡住| 免费在线欧美视频| 在线综合亚洲欧美在线视频| 粉嫩久久99精品久久久久久夜| 综合久久国产九一剧情麻豆| 欧美日韩激情一区二区三区| 美女网站色91| 亚洲美女一区二区三区| 久久综合久久综合久久综合| 色成年激情久久综合| 亚洲欧美日韩中文字幕一区二区三区 | 久久99国产精品久久| 亚洲综合一区二区三区| 亚洲欧洲韩国日本视频| 国产人妖乱国产精品人妖| 欧美精品一二三区| 色综合久久综合网欧美综合网| 精品一区二区在线看| 老司机精品视频导航| 日韩影院精彩在线| 国产精品一二一区| 国产在线精品一区二区三区不卡 | 不卡的av中国片| 黑人精品欧美一区二区蜜桃| 五月婷婷综合网| 午夜精品aaa| 亚洲欧美综合色| 久久久久99精品一区| 国产片一区二区| 亚洲欧美福利一区二区| 亚洲精品国产品国语在线app| 国产亚洲精品资源在线26u| 26uuu亚洲综合色欧美| 国产色91在线| 亚洲在线视频一区| 麻豆国产精品视频| 免费在线欧美视频| 国产精品456露脸| 成人app网站| 风间由美性色一区二区三区| 99久久国产综合精品女不卡 | 欧美日韩久久久| www成人在线观看| 亚洲国产精品久久不卡毛片| 蜜臀91精品一区二区三区| 99久久国产免费看| 日韩精品在线一区| 亚洲一级在线观看| 欧美猛男gaygay网站| 亚洲欧美日韩一区| 国产一区二区三区久久久| 蜜桃视频在线一区| 色老汉一区二区三区| 国产精品成人免费精品自在线观看| 国产综合色在线| 精品国产123| 精品无人码麻豆乱码1区2区| 7777精品伊人久久久大香线蕉 | 国产a精品视频| 国产精品女同一区二区三区| 日本不卡不码高清免费观看| 欧美精品第1页| 毛片av一区二区| 国产午夜精品久久久久久免费视| 国产乱理伦片在线观看夜一区| 久久亚洲二区三区| 成人在线视频一区二区| 最新中文字幕一区二区三区 | 久久久久久日产精品| 高清成人免费视频| 亚洲一线二线三线久久久| 日韩亚洲电影在线| 国产不卡高清在线观看视频| 一区二区三区美女| 精品国产一区二区三区久久久蜜月| 国产精选一区二区三区| 国产精品国产自产拍高清av王其| 欧美做爰猛烈大尺度电影无法无天| 日日摸夜夜添夜夜添国产精品 | 日本乱码高清不卡字幕| 国内精品视频666| 婷婷开心激情综合| 综合av第一页|