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

? 歡迎來(lái)到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關(guān)于我們
? 蟲蟲下載站

?? interrupt.c

?? 本代碼是用C8051F330 MCU對(duì)24LC256EEPROM的讀寫和與RS232終端以9600BPS速率通信代碼.
?? C
字號(hào):
#define INT_ISR_C


#include "c8051F330.h"
#include "rs232.h"


char rece,count_UART,count_UART1;
char Rec_OK,Tran_OK;
char Tran_Flag;
char xdata sRecComBuf[8];
char *pointer;
void UART_Isr(void)  interrupt 4
{
	ES0 = 0x0;
	if(TI0)
		{
			SCON0 &=0xFD;
			Tran_Flag=0;
			if (count_UART1==8)
				Tran_OK=0x45;
				
		}
 	else
		{
			SCON0 &=0xFE;
			*pointer++ = SBUF0;
			count_UART++;
			if (count_UART==8)
			{
				Rec_OK=0x23;
			}
			
		}
	ES0 = 0x1;	 
} 





//------------------------------------------------------------------------------------
// 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
{
   SMB0CF &= ~0x80;          // Disable SMBus
   SMB0CF |= 0x80;           // Re-enable SMBus
   TMR3CN &= ~0x80;          // Clear Timer3 interrupt-pending flag
}






//------------------------------------------------------------------------------------
// 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;                              // 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's high 8bits address

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

               break;
            }

		else if(SMB_SENDWORDADDR1)             // Are we sending the word address?
            {
               SMB_SENDWORDADDR1 = 0;         // Clear flag
               SMB0DAT = WORD_ADDR1;          // send word's low 8bits 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
}



//------------------------------------------------------------------------------------
// Functions
//------------------------------------------------------------------------------------

//------------------------------------------------------------------------------------
// EEPROM_ByteWrite ()
//------------------------------------------------------------------------------------
//
// This function writes the value in <dat> to location <addr> in the EEPROM then 
// polls the EEPROM until the write is complete.
//
void EEPROM_ByteWrite( unsigned int addr, unsigned char dat )
{
   while (SMB_BUSY);                         // Wait for SMBus to be free.
   SMB_BUSY = 1;                             // Claim SMBus (set to busy)

   // Set SMBus ISR parameters
   TARGET = EEPROM_ADDR;                     // Set target slave address
   SMB_RW = WRITE;                           // Mark next transfer as a write
   SMB_SENDWORDADDR = 1;                     // Send high 8bits Word Address after Slave Address
   SMB_SENDWORDADDR1 = 1;                     // Send low 8bits Word Address after Slave Address
   SMB_RANDOMREAD = 0;                       // Do not send a START signal after
                                             // the word address
   SMB_ACKPOLL = 1;                          // Enable Acknowledge Polling (The ISR
                                             // will automatically restart the 
                                             // transfer if the slave does not 
                                             // acknoledge its address.

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

   WORD_ADDR1 = addr%256;                         // Set the target address in the 
                                             // EEPROM's internal memory space
											 
   SMB_SINGLEBYTE_OUT = dat;                 // store dat (local variable) in a global
                                             // variable so the ISR can read it after
                                             // this function exits

   pSMB_DATA_OUT = &SMB_SINGLEBYTE_OUT;      // The outgoing data pointer points to
                                             // the <dat> variable.

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

   // Initiate SMBus Transfer
   STA = 1;

}





//------------------------------------------------------------------------------------
// EEPROM_ByteRead ()
//------------------------------------------------------------------------------------
//
// This function returns a single byte from location <addr> in the EEPROM then 
// polls the <SMB_BUSY> flag until the read is complete.
//
unsigned char EEPROM_ByteRead( unsigned int addr)
{
   unsigned char retval;                     // Holds the return value

   while (SMB_BUSY);                         // Wait for SMBus to be free.
   SMB_BUSY = 1;                             // Claim SMBus (set to busy)

   // Set SMBus ISR parameters
   TARGET = EEPROM_ADDR;                     // Set target slave address
   SMB_RW = WRITE;                           // A random read starts as a write
                                             // then changes to a read after
                                             // the repeated start is sent. The
                                             // ISR handles this switchover if
                                             // the <SMB_RANDOMREAD> bit is set.
   SMB_SENDWORDADDR = 1;                     // Send high 8bits Word Address after Slave Address
   SMB_SENDWORDADDR1 = 1;                     // Send low 8bits Word Address after Slave Address
   SMB_RANDOMREAD = 1;                       // Send a START after the word address
   SMB_ACKPOLL = 1;                          // Enable Acknowledge Polling


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

   WORD_ADDR1 = addr%256;                         // 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;

}

?? 快捷鍵說(shuō)明

復(fù)制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號(hào) Ctrl + =
減小字號(hào) Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
狠狠色狠狠色综合系列| 99热精品国产| 美国欧美日韩国产在线播放| 亚洲国产精品久久人人爱蜜臀| 国产精品婷婷午夜在线观看| 久久久美女毛片| 久久久www成人免费无遮挡大片| 911精品国产一区二区在线| 欧美性一级生活| 欧美酷刑日本凌虐凌虐| 91精品欧美综合在线观看最新| 在线播放91灌醉迷j高跟美女| 欧美日本国产视频| 欧美一区二区视频在线观看| 欧美丰满一区二区免费视频| 欧美日韩美女一区二区| 欧美高清hd18日本| 欧美成人激情免费网| 精品美女一区二区三区| 日韩女优av电影| 久久影院午夜论| 中文字幕第一区二区| 亚洲色图视频免费播放| 91久久一区二区| 日本乱人伦aⅴ精品| 日韩成人精品在线观看| 蜜桃av一区二区三区电影| 久久国产夜色精品鲁鲁99| 欧美一区二区私人影院日本| 777a∨成人精品桃花网| 欧美电影免费观看高清完整版在| 2023国产一二三区日本精品2022| 欧美激情一区二区三区四区| 亚洲精品视频观看| 日本vs亚洲vs韩国一区三区 | 久久精品亚洲精品国产欧美 | 午夜精品久久久久久久蜜桃app| 三级一区在线视频先锋| 麻豆精品在线观看| 国产成人免费在线观看| 欧美视频一区二区三区四区| 日韩亚洲欧美综合| 中文字幕av免费专区久久| 亚洲激情综合网| 秋霞电影一区二区| 欧美成人a视频| 中文字幕av免费专区久久| 色综合久久综合| 成人网在线免费视频| 一本大道久久a久久综合婷婷| 欧美图片一区二区三区| 久久综合久色欧美综合狠狠| 亚洲视频在线观看一区| 美女视频网站黄色亚洲| 91小视频免费观看| 精品国产乱码久久久久久图片| 亚洲欧洲日韩在线| 久久精品99久久久| 一本大道久久精品懂色aⅴ| 亚洲精品一区二区三区影院| 亚洲在线成人精品| 国产在线精品一区二区不卡了| 色诱亚洲精品久久久久久| 久久综合久久综合久久综合| 亚洲一区二区在线免费观看视频| 国产乱码字幕精品高清av| 欧美午夜电影一区| 国产精品久久久久久久久果冻传媒 | av成人免费在线| 欧美一区二区福利在线| 亚洲成av人片观看| 亚洲午夜三级在线| 亚洲精品国产品国语在线app| 亚洲美女区一区| 久久99精品国产麻豆不卡| 色哟哟在线观看一区二区三区| 日韩精品一区二区三区四区| 亚洲摸摸操操av| 国产经典欧美精品| 日韩一级免费一区| 亚洲一区影音先锋| 成人av午夜电影| 久久综合久久综合久久| 日韩av网站免费在线| 欧洲一区在线观看| 中文字幕一区二区三中文字幕| 国产一区二区在线看| 日韩三级.com| 伊人性伊人情综合网| 99精品视频在线免费观看| 国产日韩欧美电影| 九色综合狠狠综合久久| 91麻豆精品国产自产在线 | 国产精品乱人伦中文| 国产最新精品精品你懂的| 奇米影视一区二区三区小说| 日韩欧美亚洲国产另类| 污片在线观看一区二区| 三级亚洲高清视频| 色一情一乱一乱一91av| 国产精品视频麻豆| 国产精品亚洲视频| 久久人人97超碰com| 精品无人区卡一卡二卡三乱码免费卡 | 亚洲综合色成人| 在线精品视频小说1| 亚洲日本在线看| 一本色道久久综合亚洲精品按摩| 亚洲欧美中日韩| 色综合天天综合狠狠| 亚洲视频一区在线| 欧美亚一区二区| 亚洲高清不卡在线| 555夜色666亚洲国产免| 美女www一区二区| 久久免费视频一区| 国产成a人亚洲精| 综合自拍亚洲综合图不卡区| 97成人超碰视| 亚洲成a人片综合在线| 欧美一区二区在线免费播放| 蜜臀va亚洲va欧美va天堂| 精品久久久影院| 亚洲一区二区在线免费观看视频 | 国产成人午夜视频| 国产亚洲精品7777| 成人黄动漫网站免费app| 成人欧美一区二区三区| 日本福利一区二区| 天天操天天色综合| wwwwxxxxx欧美| 成人av片在线观看| 亚洲一区成人在线| 日韩精品一区二区三区在线| 国产成人综合自拍| 亚洲精品高清在线观看| 日韩一区二区三区视频| 丁香婷婷综合五月| 亚洲午夜在线观看视频在线| 日韩女优av电影在线观看| 成人av电影在线| 午夜伦欧美伦电影理论片| 久久男人中文字幕资源站| 色婷婷综合久久久中文一区二区| 天天综合色天天综合色h| 久久夜色精品国产欧美乱极品| av不卡在线播放| 免费一级欧美片在线观看| 国产精品色哟哟| 欧美区视频在线观看| 成人手机在线视频| 天堂蜜桃91精品| 久久综合色之久久综合| 日韩午夜在线播放| 一区二区三区美女视频| 成人小视频在线| 午夜精品一区二区三区电影天堂| 精品国产乱码久久久久久影片| 91浏览器入口在线观看| 麻豆一区二区三| 一区二区三区四区蜜桃 | 久久久不卡网国产精品二区| 91国在线观看| 国产老妇另类xxxxx| 亚洲超碰97人人做人人爱| 国产亚洲一区二区在线观看| 欧美日韩国产大片| 99精品视频在线观看免费| 久久91精品久久久久久秒播| 伊人婷婷欧美激情| 国产亲近乱来精品视频 | 亚洲欧美偷拍三级| 久久久久久一级片| 91精品国产全国免费观看| av网站一区二区三区| 国产综合色视频| 日韩经典中文字幕一区| 一区二区成人在线视频| 国产日产亚洲精品系列| 日韩欧美在线网站| 欧美日韩性生活| 一道本成人在线| 91精品欧美久久久久久动漫| 日韩精品成人一区二区三区| 日韩欧美色综合网站| 欧美性受极品xxxx喷水| 成a人片国产精品| 国产九色sp调教91| 免费欧美日韩国产三级电影| 亚洲国产精品一区二区www| 最近日韩中文字幕| 亚洲欧洲一区二区在线播放| 2020国产精品自拍| 精品国产电影一区二区| 日韩一区二区在线观看视频| 欧美三级日本三级少妇99| 91黄色小视频| 91黄色免费观看| 在线观看日韩一区| 在线观看日韩国产|