C51 COMPILER V9.59.0.0 STC8A_PCA_ISR 06/10/2021 11:07:31 PAGE 1 C51 COMPILER V9.59.0.0, COMPILATION OF MODULE STC8A_PCA_ISR OBJECT MODULE PLACED IN .\list\STC8A_PCA_Isr.obj COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE ..\Driver\isr\STC8A_PCA_Isr.c LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR -(..\Driver\inc;..\User;..\App\inc) DEBUG PRINT(.\list\STC8A_PCA_Isr.lst) TABS(2) OBJECT(.\list\STC8A_PCA_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_PCA.h" 14 15 //======================================================================== 16 // 本地变量声明 17 //======================================================================== 18 19 u16 CAP0_Old,CAP1_Old,CAP2_Old,CAP3_Old; //记录上一次的捕获值 20 u16 CAP0_New,CAP1_New,CAP2_New,CAP3_New; //记录本次的捕获值 21 22 //======================================================================== 23 // 函数: PCA_ISR_Handler 24 // 描述: PCA中断函数. 25 // 参数: none. 26 // 返回: none. 27 // 版本: V1.0, 2020-09-23 28 //======================================================================== 29 void PCA_ISR_Handler (void) interrupt PCA_VECTOR 30 { 31 1 char store; 32 1 33 1 if(CCF0) //PCA模块0中断 34 1 { 35 2 CCF0 = 0; //清PCA模块0中断标志 36 2 // TODO: 在此处添加用户代码 37 2 if(CCAPM0 >= PCA_Mode_SoftTimer) //PCA_Mode_SoftTimer and PCA_Mode_HighPulseOutput 38 2 { 39 3 CCAP0_tmp += PCA_Timer0; 40 3 CCAP0L = (u8)CCAP0_tmp; //将影射寄存器写入捕获寄存器,先写CCAP0L 41 3 CCAP0H = (u8)(CCAP0_tmp >> 8); //后写CCAP0H 42 3 } 43 2 else if(CCAPM0 & PCA_Mode_Capture) 44 2 { 45 3 CAP0_Old = CAP0_New; 46 3 CAP0_New = CCAP0H; //读CCAP0H 47 3 CAP0_New = (CAP0_New << 8) + CCAP0L; 48 3 CCAP0_tmp = CAP0_New - CAP0_Old; 49 3 B_Capture0 = 1; 50 3 } 51 2 } 52 1 53 1 if(CCF1) //PCA模块1中断 54 1 { C51 COMPILER V9.59.0.0 STC8A_PCA_ISR 06/10/2021 11:07:31 PAGE 2 55 2 CCF1 = 0; //清PCA模块1中断标志 56 2 // TODO: 在此处添加用户代码 57 2 if(CCAPM1 >= PCA_Mode_SoftTimer) //PCA_Mode_SoftTimer and PCA_Mode_HighPulseOutput 58 2 { 59 3 CCAP1_tmp += PCA_Timer1; 60 3 CCAP1L = (u8)CCAP1_tmp; //将影射寄存器写入捕获寄存器,先写CCAP0L 61 3 CCAP1H = (u8)(CCAP1_tmp >> 8); //后写CCAP0H 62 3 } 63 2 else if(CCAPM1 & PCA_Mode_Capture) 64 2 { 65 3 CAP1_Old = CAP1_New; 66 3 CAP1_New = CCAP1H; //读CCAP1H 67 3 CAP1_New = (CAP1_New << 8) + CCAP1L; 68 3 CCAP1_tmp = CAP1_New - CAP1_Old; 69 3 B_Capture1 = 1; 70 3 } 71 2 } 72 1 73 1 if(CCF2) //PCA模块2中断 74 1 { 75 2 CCF2 = 0; //清PCA模块1中断标志 76 2 // TODO: 在此处添加用户代码 77 2 if(CCAPM2 >= PCA_Mode_SoftTimer) //PCA_Mode_SoftTimer and PCA_Mode_HighPulseOutput 78 2 { 79 3 CCAP2_tmp += PCA_Timer2; 80 3 CCAP2L = (u8)CCAP2_tmp; //将影射寄存器写入捕获寄存器,先写CCAP0L 81 3 CCAP2H = (u8)(CCAP2_tmp >> 8); //后写CCAP0H 82 3 } 83 2 else if(CCAPM2 & PCA_Mode_Capture) 84 2 { 85 3 CAP2_Old = CAP2_New; 86 3 CAP2_New = CCAP2H; //读CCAP2H 87 3 CAP2_New = (CAP2_New << 8) + CCAP2L; 88 3 CCAP2_tmp = CAP2_New - CAP2_Old; 89 3 B_Capture2 = 1; 90 3 } 91 2 } 92 1 93 1 if(CCF3) //PCA模块3中断 94 1 { 95 2 store = P_SW2; 96 2 P_SW2 |= 0x80; 97 2 98 2 CCF3 = 0; //清PCA模块1中断标志 99 2 // TODO: 在此处添加用户代码 100 2 if(CCAPM3 >= PCA_Mode_SoftTimer) //PCA_Mode_SoftTimer and PCA_Mode_HighPulseOutput 101 2 { 102 3 CCAP3_tmp += PCA_Timer3; 103 3 CCAP3L = (u8)CCAP3_tmp; //将影射寄存器写入捕获寄存器,先写CCAPxL 104 3 CCAP3H = (u8)(CCAP3_tmp >> 8); //后写CCAPxH 105 3 } 106 2 else if(CCAPM3 & PCA_Mode_Capture) 107 2 { 108 3 CAP3_Old = CAP3_New; 109 3 CAP3_New = CCAP3H; //读CCAP3H 110 3 CAP3_New = (CAP3_New << 8) + CCAP3L; 111 3 CCAP3_tmp = CAP3_New - CAP3_Old; 112 3 B_Capture3 = 1; 113 3 } 114 2 P_SW2 = store; 115 2 } 116 1 C51 COMPILER V9.59.0.0 STC8A_PCA_ISR 06/10/2021 11:07:31 PAGE 3 117 1 if(CF) //PCA溢出中断 118 1 { 119 2 CF = 0; //清PCA溢出中断标志 120 2 // TODO: 在此处添加用户代码 121 2 } 122 1 123 1 } MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 574 ---- CONSTANT SIZE = ---- ---- XDATA SIZE = 16 ---- PDATA SIZE = ---- ---- DATA SIZE = ---- ---- IDATA SIZE = ---- ---- BIT SIZE = ---- ---- EDATA SIZE = ---- ---- HDATA SIZE = ---- ---- XDATA CONST SIZE = ---- ---- FAR CONST SIZE = ---- ---- END OF MODULE INFORMATION. C51 COMPILATION COMPLETE. 0 WARNING(S), 0 ERROR(S)