C51 COMPILER V9.59.0.0 STC8A_I2C_ISR 06/10/2021 10:21:47 PAGE 1 C51 COMPILER V9.59.0.0, COMPILATION OF MODULE STC8A_I2C_ISR OBJECT MODULE PLACED IN .\list\STC8A_I2C_Isr.obj COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE ..\Driver\isr\STC8A_I2C_Isr.c LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR -(..\Driver\inc;..\User;..\App\inc) DEBUG PRINT(.\list\STC8A_I2C_Isr.lst) TABS(2) OBJECT(.\list\STC8A_I2C_Isr.obj) line level source 1 /*---------------------------------------------------------------------*/ 2 /* --- STC MCU Limited ------------------------------------------------*/ 3 /* --- STC 1T Series MCU Demo Programme -------------------------------*/ 4 /* --- Mobile: (86)13922805190 ----------------------------------------*/ 5 /* --- Fax: 86-0513-55012956,55012947,55012969 ------------------------*/ 6 /* --- Tel: 86-0513-55012928,55012929,55012966 ------------------------*/ 7 /* --- Web: www.STCMCU.com --------------------------------------------*/ 8 /* --- Web: www.STCMCUDATA.com ---------------------------------------*/ 9 /* --- QQ: 800003751 -------------------------------------------------*/ 10 /* 如果要在程序中使用此代码,请在程序中注明使用了STC的资料及程序 */ 11 /*---------------------------------------------------------------------*/ 12 13 #include "STC8A_I2C.h" 14 15 //======================================================================== 16 // 本地变量声明 17 //======================================================================== 18 19 I2C_IsrTypeDef I2CIsr; 20 bit DisplayFlag; 21 22 //======================================================================== 23 // 外部函数和变量声明 24 //======================================================================== 25 26 27 //======================================================================== 28 // 函数: I2C_ISR_Handler 29 // 描述: I2C中断函数. 30 // 参数: none. 31 // 返回: none. 32 // 版本: V1.0, 2020-09-23 33 //======================================================================== 34 void I2C_ISR_Handler() interrupt I2C_VECTOR 35 { 36 1 char store; 37 1 38 1 store = P_SW2; 39 1 P_SW2 |= 0x80; 40 1 41 1 // TODO: 在此处添加用户代码 42 1 if (I2CSLST & 0x40) 43 1 { 44 2 I2CSLST &= ~0x40; //处理START事件 45 2 } 46 1 else if (I2CSLST & 0x20) 47 1 { 48 2 I2CSLST &= ~0x20; //处理RECV事件,SLACKO设置为0 49 2 if (I2CIsr.isda) 50 2 { 51 3 I2CIsr.isda = 0; //处理RECV事件(RECV DEVICE ADDR) 52 3 } 53 2 else if (I2CIsr.isma) 54 2 { C51 COMPILER V9.59.0.0 STC8A_I2C_ISR 06/10/2021 10:21:47 PAGE 2 55 3 I2CIsr.isma = 0; //处理RECV事件(RECV MEMORY ADDR) 56 3 I2CIsr.addr = I2CRXD; 57 3 I2CTXD = I2C_Buffer[I2CIsr.addr]; 58 3 } 59 2 else 60 2 { 61 3 I2C_Buffer[I2CIsr.addr++] = I2CRXD; //处理RECV事件(RECV DATA) 62 3 } 63 2 } 64 1 else if (I2CSLST & 0x10) 65 1 { 66 2 I2CSLST &= ~0x10; //处理SEND事件 67 2 if (I2CSLST & 0x02) 68 2 { 69 3 I2CTXD = 0xff; 70 3 } 71 2 else 72 2 { 73 3 I2CTXD = I2C_Buffer[++I2CIsr.addr]; 74 3 } 75 2 } 76 1 else if (I2CSLST & 0x08) 77 1 { 78 2 I2CSLST &= ~0x08; //处理STOP事件 79 2 I2CIsr.isda = 1; 80 2 I2CIsr.isma = 1; 81 2 DisplayFlag = 1; 82 2 } 83 1 84 1 P_SW2 = store; 85 1 } 86 MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 190 ---- CONSTANT SIZE = ---- ---- XDATA SIZE = 3 ---- PDATA SIZE = ---- ---- DATA SIZE = ---- ---- IDATA SIZE = ---- ---- BIT SIZE = 1 ---- EDATA SIZE = ---- ---- HDATA SIZE = ---- ---- XDATA CONST SIZE = ---- ---- FAR CONST SIZE = ---- ---- END OF MODULE INFORMATION. C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)