C51 COMPILER V9.59.0.0 STC8A_NVIC 06/10/2021 10:21:43 PAGE 1 C51 COMPILER V9.59.0.0, COMPILATION OF MODULE STC8A_NVIC OBJECT MODULE PLACED IN .\list\STC8A_NVIC.obj COMPILER INVOKED BY: C:\Keil_v5\C51\BIN\C51.EXE ..\Driver\src\STC8A_NVIC.c LARGE OMF2 OPTIMIZE(8,SPEED) BROWSE INCDIR(.. -\Driver\inc;..\User;..\App\inc) DEBUG PRINT(.\list\STC8A_NVIC.lst) TABS(2) OBJECT(.\list\STC8A_NVIC.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_NVIC.h" 14 15 //======================================================================== 16 // 函数: NVIC_Timer0_Init 17 // 描述: Timer0嵌套向量中断控制器初始化. 18 // 参数: State: 中断使能状态, ENABLE/DISABLE. 19 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 20 // 返回: 执行结果 SUCCESS/FAIL. 21 // 版本: V1.0, 2020-09-29 22 //======================================================================== 23 u8 NVIC_Timer0_Init(u8 State, u8 Priority) 24 { 25 1 if(State <= ENABLE) Timer0_Interrupt(State); 26 1 if(Priority <= Priority_3) Timer0_Priority(Priority); 27 1 return SUCCESS; 28 1 } 29 30 //======================================================================== 31 // 函数: NVIC_Timer1_Init 32 // 描述: Timer1嵌套向量中断控制器初始化. 33 // 参数: State: 中断使能状态, ENABLE/DISABLE. 34 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 35 // 返回: 执行结果 SUCCESS/FAIL. 36 // 版本: V1.0, 2020-09-29 37 //======================================================================== 38 u8 NVIC_Timer1_Init(u8 State, u8 Priority) 39 { 40 1 if(State <= ENABLE) Timer1_Interrupt(State); 41 1 if(Priority <= Priority_3) Timer1_Priority(Priority); 42 1 return SUCCESS; 43 1 } 44 45 //======================================================================== 46 // 函数: NVIC_Timer2_Init 47 // 描述: Timer2嵌套向量中断控制器初始化. 48 // 参数: State: 中断使能状态, ENABLE/DISABLE. 49 // 参数: Priority: 中断优先级, NULL. 50 // 返回: 执行结果 SUCCESS/FAIL. 51 // 版本: V1.0, 2020-09-29 52 //======================================================================== 53 u8 NVIC_Timer2_Init(u8 State, u8 Priority) 54 { C51 COMPILER V9.59.0.0 STC8A_NVIC 06/10/2021 10:21:43 PAGE 2 55 1 if(State <= ENABLE) Timer2_Interrupt(State); 56 1 Priority = NULL; 57 1 return SUCCESS; 58 1 } 59 60 //======================================================================== 61 // 函数: NVIC_Timer3_Init 62 // 描述: Timer3嵌套向量中断控制器初始化. 63 // 参数: State: 中断使能状态, ENABLE/DISABLE. 64 // 参数: Priority: 中断优先级, NULL. 65 // 返回: 执行结果 SUCCESS/FAIL. 66 // 版本: V1.0, 2020-09-29 67 //======================================================================== 68 u8 NVIC_Timer3_Init(u8 State, u8 Priority) 69 { 70 1 if(State <= ENABLE) Timer3_Interrupt(State); 71 1 Priority = NULL; 72 1 return SUCCESS; 73 1 } 74 75 //======================================================================== 76 // 函数: NVIC_Timer4_Init 77 // 描述: Timer4嵌套向量中断控制器初始化. 78 // 参数: State: 中断使能状态, ENABLE/DISABLE. 79 // 参数: Priority: 中断优先级, NULL. 80 // 返回: 执行结果 SUCCESS/FAIL. 81 // 版本: V1.0, 2020-09-29 82 //======================================================================== 83 u8 NVIC_Timer4_Init(u8 State, u8 Priority) 84 { 85 1 if(State <= ENABLE) Timer4_Interrupt(State); 86 1 Priority = NULL; 87 1 return SUCCESS; 88 1 } 89 90 //======================================================================== 91 // 函数: NVIC_INT0_Init 92 // 描述: INT0嵌套向量中断控制器初始化. 93 // 参数: State: 中断使能状态, ENABLE/DISABLE. 94 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 95 // 返回: 执行结果 SUCCESS/FAIL. 96 // 版本: V1.0, 2020-09-29 97 //======================================================================== 98 u8 NVIC_INT0_Init(u8 State, u8 Priority) 99 { 100 1 if(State <= ENABLE) INT0_Interrupt(State); 101 1 if(Priority <= Priority_3) INT0_Priority(Priority); 102 1 return SUCCESS; 103 1 } 104 105 //======================================================================== 106 // 函数: NVIC_INT1_Init 107 // 描述: INT1嵌套向量中断控制器初始化. 108 // 参数: State: 中断使能状态, ENABLE/DISABLE. 109 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 110 // 返回: 执行结果 SUCCESS/FAIL. 111 // 版本: V1.0, 2020-09-29 112 //======================================================================== 113 u8 NVIC_INT1_Init(u8 State, u8 Priority) 114 { 115 1 if(State <= ENABLE) INT1_Interrupt(State); 116 1 if(Priority <= Priority_3) INT1_Priority(Priority); C51 COMPILER V9.59.0.0 STC8A_NVIC 06/10/2021 10:21:43 PAGE 3 117 1 return SUCCESS; 118 1 } 119 120 //======================================================================== 121 // 函数: NVIC_INT2_Init 122 // 描述: INT2嵌套向量中断控制器初始化. 123 // 参数: State: 中断使能状态, ENABLE/DISABLE. 124 // 参数: Priority: 中断优先级, NULL. 125 // 返回: 执行结果 SUCCESS/FAIL. 126 // 版本: V1.0, 2020-09-29 127 //======================================================================== 128 u8 NVIC_INT2_Init(u8 State, u8 Priority) 129 { 130 1 if(State <= ENABLE) INT2_Interrupt(State); 131 1 Priority = NULL; 132 1 return SUCCESS; 133 1 } 134 135 //======================================================================== 136 // 函数: NVIC_INT3_Init 137 // 描述: INT3嵌套向量中断控制器初始化. 138 // 参数: State: 中断使能状态, ENABLE/DISABLE. 139 // 参数: Priority: 中断优先级, NULL. 140 // 返回: 执行结果 SUCCESS/FAIL. 141 // 版本: V1.0, 2020-09-29 142 //======================================================================== 143 u8 NVIC_INT3_Init(u8 State, u8 Priority) 144 { 145 1 if(State <= ENABLE) INT3_Interrupt(State); 146 1 Priority = NULL; 147 1 return SUCCESS; 148 1 } 149 150 //======================================================================== 151 // 函数: NVIC_INT4_Init 152 // 描述: INT4嵌套向量中断控制器初始化. 153 // 参数: State: 中断使能状态, ENABLE/DISABLE. 154 // 参数: Priority: 中断优先级, NULL. 155 // 返回: 执行结果 SUCCESS/FAIL. 156 // 版本: V1.0, 2020-09-29 157 //======================================================================== 158 u8 NVIC_INT4_Init(u8 State, u8 Priority) 159 { 160 1 if(State <= ENABLE) INT4_Interrupt(State); 161 1 Priority = NULL; 162 1 return SUCCESS; 163 1 } 164 165 //======================================================================== 166 // 函数: NVIC_ADC_Init 167 // 描述: ADC嵌套向量中断控制器初始化. 168 // 参数: State: 中断使能状态, ENABLE/DISABLE. 169 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 170 // 返回: 执行结果 SUCCESS/FAIL. 171 // 版本: V1.0, 2020-09-29 172 //======================================================================== 173 u8 NVIC_ADC_Init(u8 State, u8 Priority) 174 { 175 1 if(State <= ENABLE) ADC_Interrupt(State); 176 1 if(Priority <= Priority_3) ADC_Priority(Priority); 177 1 return SUCCESS; 178 1 } C51 COMPILER V9.59.0.0 STC8A_NVIC 06/10/2021 10:21:43 PAGE 4 179 180 //======================================================================== 181 // 函数: NVIC_CMP_Init 182 // 描述: 比较器嵌套向量中断控制器初始化. 183 // 参数: State: 中断使能状态, RISING_EDGE/FALLING_EDGE/DISABLE. 184 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 185 // 返回: 执行结果 SUCCESS/FAIL. 186 // 版本: V1.0, 2020-09-29 187 //======================================================================== 188 u8 NVIC_CMP_Init(u8 State, u8 Priority) 189 { 190 1 if(State & RISING_EDGE) CMPCR1 |= PIE; //允许上升沿中断 191 1 else CMPCR1 &= ~PIE; //禁止上升沿中断 192 1 if(State & FALLING_EDGE) CMPCR1 |= NIE; //允许下降沿中断 193 1 else CMPCR1 &= ~NIE; //禁止上升沿中断 194 1 if(Priority <= Priority_3) CMP_Priority(Priority); 195 1 return SUCCESS; 196 1 } 197 198 //======================================================================== 199 // 函数: NVIC_I2C_Init 200 // 描述: I2C嵌套向量中断控制器初始化. 201 // 参数: Mode: 模式, I2C_Mode_Master/I2C_Mode_Slave. 202 // 参数: State: 中断使能状态, I2C_Mode_Master: ENABLE/DISABLE. 203 // I2C_Mode_Slave: I2C_ESTAI/I2C_ERXI/I2C_ETXI/I2C_ESTOI/DISABLE. 204 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 205 // 返回: 执行结果 SUCCESS/FAIL. 206 // 版本: V1.0, 2020-09-29 207 //======================================================================== 208 u8 NVIC_I2C_Init(u8 Mode, u8 State, u8 Priority) 209 { 210 1 if(Mode > 1) return FAIL; 211 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 212 1 if(Mode == 1) //I2C_Mode_Master 213 1 { 214 2 I2C_Master_Inturrupt(State); 215 2 } 216 1 else if(Mode == 0) //I2C_Mode_Slave 217 1 { 218 2 I2CSLCR = (I2CSLCR & ~0x78) | State; 219 2 } 220 1 // EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 221 1 if(Priority <= Priority_3) CMP_Priority(Priority); 222 1 return SUCCESS; 223 1 } 224 225 //======================================================================== 226 // 函数: NVIC_UART1_Init 227 // 描述: UART1嵌套向量中断控制器初始化. 228 // 参数: State: 中断使能状态, ENABLE/DISABLE. 229 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 230 // 返回: 执行结果 SUCCESS/FAIL. 231 // 版本: V1.0, 2020-09-29 232 //======================================================================== 233 u8 NVIC_UART1_Init(u8 State, u8 Priority) 234 { 235 1 if(State <= ENABLE) UART1_Interrupt(State); 236 1 if(Priority <= Priority_3) UART1_Priority(Priority); 237 1 return SUCCESS; 238 1 } 239 240 //======================================================================== C51 COMPILER V9.59.0.0 STC8A_NVIC 06/10/2021 10:21:43 PAGE 5 241 // 函数: NVIC_UART2_Init 242 // 描述: UART2嵌套向量中断控制器初始化. 243 // 参数: State: 中断使能状态, ENABLE/DISABLE. 244 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 245 // 返回: 执行结果 SUCCESS/FAIL. 246 // 版本: V1.0, 2020-09-29 247 //======================================================================== 248 u8 NVIC_UART2_Init(u8 State, u8 Priority) 249 { 250 1 if(State <= ENABLE) UART2_Interrupt(State); 251 1 if(Priority <= Priority_3) UART2_Priority(Priority); 252 1 return SUCCESS; 253 1 } 254 255 //======================================================================== 256 // 函数: NVIC_UART3_Init 257 // 描述: UART3嵌套向量中断控制器初始化. 258 // 参数: State: 中断使能状态, ENABLE/DISABLE. 259 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 260 // 返回: 执行结果 SUCCESS/FAIL. 261 // 版本: V1.0, 2020-09-29 262 //======================================================================== 263 u8 NVIC_UART3_Init(u8 State, u8 Priority) 264 { 265 1 if(State <= ENABLE) UART3_Interrupt(State); 266 1 if(Priority <= Priority_3) UART3_Priority(Priority); 267 1 return SUCCESS; 268 1 } 269 270 //======================================================================== 271 // 函数: NVIC_UART4_Init 272 // 描述: UART4嵌套向量中断控制器初始化. 273 // 参数: State: 中断使能状态, ENABLE/DISABLE. 274 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 275 // 返回: 执行结果 SUCCESS/FAIL. 276 // 版本: V1.0, 2020-09-29 277 //======================================================================== 278 u8 NVIC_UART4_Init(u8 State, u8 Priority) 279 { 280 1 if(State <= ENABLE) UART4_Interrupt(State); 281 1 if(Priority <= Priority_3) UART4_Priority(Priority); 282 1 return SUCCESS; 283 1 } 284 285 //======================================================================== 286 // 函数: NVIC_SPI_Init 287 // 描述: SPI嵌套向量中断控制器初始化. 288 // 参数: State: 中断使能状态, ENABLE/DISABLE. 289 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 290 // 返回: 执行结果 SUCCESS/FAIL. 291 // 版本: V1.0, 2020-09-29 292 //======================================================================== 293 u8 NVIC_SPI_Init(u8 State, u8 Priority) 294 { 295 1 if(State <= ENABLE) SPI_Interrupt(State); 296 1 if(Priority <= Priority_3) SPI_Priority(Priority); 297 1 return SUCCESS; 298 1 } 299 300 //======================================================================== 301 // 函数: NVIC_PCA_Init 302 // 描述: PCA嵌套向量中断控制器初始化. C51 COMPILER V9.59.0.0 STC8A_NVIC 06/10/2021 10:21:43 PAGE 6 303 // 参数: Channel: 通道, PCA0/PCA1/PCA2/PCA_Counter. 304 // 参数: State: 中断使能状态, PCA_ECOM/PCA_CCAPP/PCA_CCAPN/PCA_MAT/PCA_TOG/PCA_PWM/PCA_ECCF/DISABLE. 305 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 306 // 返回: 执行结果 SUCCESS/FAIL. 307 // 版本: V1.0, 2020-09-29 308 //======================================================================== 309 u8 NVIC_PCA_Init(u8 Channel, u8 State, u8 Priority) 310 { 311 1 // if(Channel > PCA_Counter) return FAIL; 312 1 if(Priority <= Priority_3) PCA_Priority(Priority); 313 1 switch(Channel) 314 1 { 315 2 case 0: //PCA0 316 2 CCAPM0 = State; 317 2 break; 318 2 319 2 case 1: //PCA1 320 2 CCAPM1 = State; 321 2 break; 322 2 323 2 case 2: //PCA2 324 2 CCAPM2 = State; 325 2 break; 326 2 327 2 case 3: //PCA3 328 2 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 329 2 CCAPM3 = State; 330 2 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 331 2 break; 332 2 333 2 case 4: //PCA_Counter 334 2 CMOD = (CMOD & ~1) | (State & 1); 335 2 break; 336 2 } 337 1 return SUCCESS; 338 1 } 339 340 //======================================================================== 341 // 函数: NVIC_BMM_ADC_Init 342 // 描述: BMM ADC嵌套向量中断控制器初始化. 343 // 参数: State: 中断使能状态, ENABLE/DISABLE. 344 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 345 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 346 // 返回: 执行结果 SUCCESS/FAIL. 347 // 版本: V1.0, 2021-05-21 348 //======================================================================== 349 u8 NVIC_BMM_ADC_Init(u8 State, u8 Priority, u8 Bus_Priority) 350 { 351 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 352 1 BMM_ADC_CFG &= ~0x0f; 353 1 if(Priority <= Priority_3) BMM_ADC_CFG |= Priority << 2; 354 1 if(Bus_Priority <= Priority_3) BMM_ADC_CFG |= Bus_Priority; //数据总线访问优先级 355 1 if(State == ENABLE) 356 1 BMM_ADC_CFG |= 0x80; //bit7 1:Enable Interrupt 357 1 else 358 1 BMM_ADC_CFG &= ~0x80; //bit7 0:Disable Interrupt 359 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 360 1 return SUCCESS; 361 1 } 362 363 //======================================================================== 364 // 函数: NVIC_BMM_M2M_Init C51 COMPILER V9.59.0.0 STC8A_NVIC 06/10/2021 10:21:43 PAGE 7 365 // 描述: BMM M2M嵌套向量中断控制器初始化. 366 // 参数: State: 中断使能状态, ENABLE/DISABLE. 367 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 368 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 369 // 返回: 执行结果 SUCCESS/FAIL. 370 // 版本: V1.0, 2021-05-21 371 //======================================================================== 372 u8 NVIC_BMM_M2M_Init(u8 State, u8 Priority, u8 Bus_Priority) 373 { 374 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 375 1 BMM_M2M_CFG &= ~0x0f; 376 1 if(Priority <= Priority_3) BMM_M2M_CFG |= Priority << 2; 377 1 if(Bus_Priority <= Priority_3) BMM_M2M_CFG |= Bus_Priority; //数据总线访问优先级 378 1 if(State == ENABLE) 379 1 BMM_M2M_CFG |= 0x80; //bit7 1:Enable Interrupt 380 1 else 381 1 BMM_M2M_CFG &= ~0x80; //bit7 0:Disable Interrupt 382 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 383 1 return SUCCESS; 384 1 } 385 386 //======================================================================== 387 // 函数: NVIC_BMM_SPI_Init 388 // 描述: BMM SPI嵌套向量中断控制器初始化. 389 // 参数: State: 中断使能状态, ENABLE/DISABLE. 390 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 391 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 392 // 返回: 执行结果 SUCCESS/FAIL. 393 // 版本: V1.0, 2021-05-27 394 //======================================================================== 395 u8 NVIC_BMM_SPI_Init(u8 State, u8 Priority, u8 Bus_Priority) 396 { 397 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 398 1 BMM_SPI_CFG &= ~0x0f; 399 1 if(Priority <= Priority_3) BMM_SPI_CFG |= Priority << 2; 400 1 if(Bus_Priority <= Priority_3) BMM_SPI_CFG |= Bus_Priority; //数据总线访问优先级 401 1 if(State == ENABLE) 402 1 BMM_SPI_CFG |= 0x80; //bit7 1:Enable Interrupt 403 1 else 404 1 BMM_SPI_CFG &= ~0x80; //bit7 0:Disable Interrupt 405 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 406 1 return SUCCESS; 407 1 } 408 409 //======================================================================== 410 // 函数: NVIC_BMM_UART1_Tx_Init 411 // 描述: BMM UART1 Tx嵌套向量中断控制器初始化. 412 // 参数: State: 中断使能状态, ENABLE/DISABLE. 413 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 414 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 415 // 返回: 执行结果 SUCCESS/FAIL. 416 // 版本: V1.0, 2021-05-21 417 //======================================================================== 418 u8 NVIC_BMM_UART1_Tx_Init(u8 State, u8 Priority, u8 Bus_Priority) 419 { 420 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 421 1 BMM_UR1T_CFG &= ~0x0f; 422 1 if(Priority <= Priority_3) BMM_UR1T_CFG |= Priority << 2; 423 1 if(Bus_Priority <= Priority_3) BMM_UR1T_CFG |= Bus_Priority; //数据总线访问优先级 424 1 if(State == ENABLE) 425 1 BMM_UR1T_CFG |= 0x80; //bit7 1:Enable Interrupt 426 1 else C51 COMPILER V9.59.0.0 STC8A_NVIC 06/10/2021 10:21:43 PAGE 8 427 1 BMM_UR1T_CFG &= ~0x80; //bit7 0:Disable Interrupt 428 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 429 1 return SUCCESS; 430 1 } 431 432 //======================================================================== 433 // 函数: NVIC_BMM_UART1_Rx_Init 434 // 描述: BMM UART1 Rx嵌套向量中断控制器初始化. 435 // 参数: State: 中断使能状态, ENABLE/DISABLE. 436 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 437 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 438 // 返回: 执行结果 SUCCESS/FAIL. 439 // 版本: V1.0, 2021-05-21 440 //======================================================================== 441 u8 NVIC_BMM_UART1_Rx_Init(u8 State, u8 Priority, u8 Bus_Priority) 442 { 443 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 444 1 BMM_UR1R_CFG &= ~0x0f; 445 1 if(Priority <= Priority_3) BMM_UR1R_CFG |= Priority << 2; 446 1 if(Bus_Priority <= Priority_3) BMM_UR1R_CFG |= Bus_Priority; //数据总线访问优先级 447 1 if(State == ENABLE) 448 1 BMM_UR1R_CFG |= 0x80; //bit7 1:Enable Interrupt 449 1 else 450 1 BMM_UR1R_CFG &= ~0x80; //bit7 0:Disable Interrupt 451 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 452 1 return SUCCESS; 453 1 } 454 455 //======================================================================== 456 // 函数: NVIC_BMM_UART2_Tx_Init 457 // 描述: BMM UART2 Tx嵌套向量中断控制器初始化. 458 // 参数: State: 中断使能状态, ENABLE/DISABLE. 459 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 460 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 461 // 返回: 执行结果 SUCCESS/FAIL. 462 // 版本: V1.0, 2021-05-21 463 //======================================================================== 464 u8 NVIC_BMM_UART2_Tx_Init(u8 State, u8 Priority, u8 Bus_Priority) 465 { 466 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 467 1 BMM_UR2T_CFG &= ~0x0f; 468 1 if(Priority <= Priority_3) BMM_UR2T_CFG |= Priority << 2; 469 1 if(Bus_Priority <= Priority_3) BMM_UR2T_CFG |= Bus_Priority; //数据总线访问优先级 470 1 if(State == ENABLE) 471 1 BMM_UR2T_CFG |= 0x80; //bit7 1:Enable Interrupt 472 1 else 473 1 BMM_UR2T_CFG &= ~0x80; //bit7 0:Disable Interrupt 474 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 475 1 return SUCCESS; 476 1 } 477 478 //======================================================================== 479 // 函数: NVIC_BMM_UART2_Rx_Init 480 // 描述: BMM UART2 Rx嵌套向量中断控制器初始化. 481 // 参数: State: 中断使能状态, ENABLE/DISABLE. 482 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 483 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 484 // 返回: 执行结果 SUCCESS/FAIL. 485 // 版本: V1.0, 2021-05-21 486 //======================================================================== 487 u8 NVIC_BMM_UART2_Rx_Init(u8 State, u8 Priority, u8 Bus_Priority) 488 { C51 COMPILER V9.59.0.0 STC8A_NVIC 06/10/2021 10:21:43 PAGE 9 489 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 490 1 BMM_UR2R_CFG &= ~0x0f; 491 1 if(Priority <= Priority_3) BMM_UR2R_CFG |= Priority << 2; 492 1 if(Bus_Priority <= Priority_3) BMM_UR2R_CFG |= Bus_Priority; //数据总线访问优先级 493 1 if(State == ENABLE) 494 1 BMM_UR2R_CFG |= 0x80; //bit7 1:Enable Interrupt 495 1 else 496 1 BMM_UR2R_CFG &= ~0x80; //bit7 0:Disable Interrupt 497 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 498 1 return SUCCESS; 499 1 } 500 501 //======================================================================== 502 // 函数: NVIC_BMM_UART3_Tx_Init 503 // 描述: BMM UART3 Tx嵌套向量中断控制器初始化. 504 // 参数: State: 中断使能状态, ENABLE/DISABLE. 505 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 506 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 507 // 返回: 执行结果 SUCCESS/FAIL. 508 // 版本: V1.0, 2021-05-21 509 //======================================================================== 510 u8 NVIC_BMM_UART3_Tx_Init(u8 State, u8 Priority, u8 Bus_Priority) 511 { 512 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 513 1 BMM_UR3T_CFG &= ~0x0f; 514 1 if(Priority <= Priority_3) BMM_UR3T_CFG |= Priority << 2; 515 1 if(Bus_Priority <= Priority_3) BMM_UR3T_CFG |= Bus_Priority; //数据总线访问优先级 516 1 if(State == ENABLE) 517 1 BMM_UR3T_CFG |= 0x80; //bit7 1:Enable Interrupt 518 1 else 519 1 BMM_UR3T_CFG &= ~0x80; //bit7 0:Disable Interrupt 520 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 521 1 return SUCCESS; 522 1 } 523 524 //======================================================================== 525 // 函数: NVIC_BMM_UART3_Rx_Init 526 // 描述: BMM UART3 Rx嵌套向量中断控制器初始化. 527 // 参数: State: 中断使能状态, ENABLE/DISABLE. 528 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 529 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 530 // 返回: 执行结果 SUCCESS/FAIL. 531 // 版本: V1.0, 2021-05-21 532 //======================================================================== 533 u8 NVIC_BMM_UART3_Rx_Init(u8 State, u8 Priority, u8 Bus_Priority) 534 { 535 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 536 1 BMM_UR3R_CFG &= ~0x0f; 537 1 if(Priority <= Priority_3) BMM_UR3R_CFG |= Priority << 2; 538 1 if(Bus_Priority <= Priority_3) BMM_UR3R_CFG |= Bus_Priority; //数据总线访问优先级 539 1 if(State == ENABLE) 540 1 BMM_UR3R_CFG |= 0x80; //bit7 1:Enable Interrupt 541 1 else 542 1 BMM_UR3R_CFG &= ~0x80; //bit7 0:Disable Interrupt 543 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 544 1 return SUCCESS; 545 1 } 546 547 //======================================================================== 548 // 函数: NVIC_BMM_UART4_Tx_Init 549 // 描述: BMM UART4 Tx嵌套向量中断控制器初始化. 550 // 参数: State: 中断使能状态, ENABLE/DISABLE. C51 COMPILER V9.59.0.0 STC8A_NVIC 06/10/2021 10:21:43 PAGE 10 551 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 552 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 553 // 返回: 执行结果 SUCCESS/FAIL. 554 // 版本: V1.0, 2021-05-21 555 //======================================================================== 556 u8 NVIC_BMM_UART4_Tx_Init(u8 State, u8 Priority, u8 Bus_Priority) 557 { 558 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 559 1 BMM_UR4T_CFG &= ~0x0f; 560 1 if(Priority <= Priority_3) BMM_UR4T_CFG |= Priority << 2; 561 1 if(Bus_Priority <= Priority_3) BMM_UR4T_CFG |= Bus_Priority; //数据总线访问优先级 562 1 if(State == ENABLE) 563 1 BMM_UR4T_CFG |= 0x80; //bit7 1:Enable Interrupt 564 1 else 565 1 BMM_UR4T_CFG &= ~0x80; //bit7 0:Disable Interrupt 566 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 567 1 return SUCCESS; 568 1 } 569 570 //======================================================================== 571 // 函数: NVIC_BMM_UART4_Rx_Init 572 // 描述: BMM UART4 Rx嵌套向量中断控制器初始化. 573 // 参数: State: 中断使能状态, ENABLE/DISABLE. 574 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 575 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 576 // 返回: 执行结果 SUCCESS/FAIL. 577 // 版本: V1.0, 2021-05-21 578 //======================================================================== 579 u8 NVIC_BMM_UART4_Rx_Init(u8 State, u8 Priority, u8 Bus_Priority) 580 { 581 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 582 1 BMM_UR4R_CFG &= ~0x0f; 583 1 if(Priority <= Priority_3) BMM_UR4R_CFG |= Priority << 2; 584 1 if(Bus_Priority <= Priority_3) BMM_UR4R_CFG |= Bus_Priority; //数据总线访问优先级 585 1 if(State == ENABLE) 586 1 BMM_UR4R_CFG |= 0x80; //bit7 1:Enable Interrupt 587 1 else 588 1 BMM_UR4R_CFG &= ~0x80; //bit7 0:Disable Interrupt 589 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 590 1 return SUCCESS; 591 1 } 592 593 //======================================================================== 594 // 函数: NVIC_BMM_LCM_Init 595 // 描述: BMM LCM嵌套向量中断控制器初始化. 596 // 参数: State: 中断使能状态, ENABLE/DISABLE. 597 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 598 // 参数: Bus_Priority: 数据总线访问优先级, Priority_0,Priority_1,Priority_2,Priority_3. 599 // 返回: 执行结果 SUCCESS/FAIL. 600 // 版本: V1.0, 2021-05-21 601 //======================================================================== 602 u8 NVIC_BMM_LCM_Init(u8 State, u8 Priority, u8 Bus_Priority) 603 { 604 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 605 1 BMM_LCM_CFG &= ~0x0f; 606 1 if(Priority <= Priority_3) BMM_LCM_CFG |= Priority << 2; 607 1 if(Bus_Priority <= Priority_3) BMM_LCM_CFG |= Bus_Priority; //数据总线访问优先级 608 1 if(State == ENABLE) 609 1 BMM_LCM_CFG |= 0x80; //bit7 1:Enable Interrupt 610 1 else 611 1 BMM_LCM_CFG &= ~0x80; //bit7 0:Disable Interrupt 612 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ C51 COMPILER V9.59.0.0 STC8A_NVIC 06/10/2021 10:21:43 PAGE 11 613 1 return SUCCESS; 614 1 } 615 616 //======================================================================== 617 // 函数: NVIC_LCM_Init 618 // 描述: LCM嵌套向量中断控制器初始化. 619 // 参数: State: 中断使能状态, ENABLE/DISABLE. 620 // 参数: Priority: 中断优先级, Priority_0,Priority_1,Priority_2,Priority_3. 621 // 返回: 执行结果 SUCCESS/FAIL. 622 // 版本: V1.0, 2021-05-21 623 //======================================================================== 624 u8 NVIC_LCM_Init(u8 State, u8 Priority) 625 { 626 1 EAXSFR(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展SFR(XSFR) */ 627 1 LCMIFCFG &= ~0x30; 628 1 if(Priority <= Priority_3) LCMIFCFG |= Priority << 4; 629 1 if(State == ENABLE) 630 1 LCMIFCFG |= 0x80; //bit7 1:Enable Interrupt 631 1 else 632 1 LCMIFCFG &= ~0x80; //bit7 0:Disable Interrupt 633 1 EAXRAM(); /* MOVX A,@DPTR/MOVX @DPTR,A指令的操作对象为扩展RAM(XRAM) */ 634 1 return SUCCESS; 635 1 } 636 MODULE INFORMATION: STATIC OVERLAYABLE CODE SIZE = 2168 ---- CONSTANT SIZE = ---- ---- XDATA SIZE = ---- ---- 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)