1

给定: http: //ww1.microchip.com/downloads/en/DeviceDoc/MPLAB_XC8_C_Compiler_User_Guide.pdf XC8 的 ei();// 启用全局中断

XC8 的 di(); // 禁用全局中断

AVR 的 sei() http://www.atmel.com/webdoc/avrassembler/avrassembler.wb_SEI.html

AVR 的 cli() http://www.atmel.com/webdoc/avrassembler/avrassembler.wb_CLI.html

那么它可以安全地说 ei() == sei() && di() == cli() 并且可以在切换平台时互换使用?

4

2 回答 2

2

这是关于两个芯片上的中断系统的非常笼统的陈述。它们在很多方面都非常不同。

也就是说,是的,宏设置和清除状态寄存器中的单个位,因此宏的操作方式相同。

于 2017-01-12T01:00:16.280 回答
0

如何通过 XC8 为 Atmega 设置中断?我读 了 MPLAB_XC8_C_Compiler_User_Guide_for_AVR

中断函数的示例如下所示。

void __interrupt(SPI_STC_vect_num) spi_Isr(void) {    
//I coment this: process(SPI_SlaveReceive());  
return;
}

错误

../main.c:10:18: error: expected declaration specifiers or '...' before numeric constant
                 from ../main.h:3,
 void __interrupt(SPI_STC_vect_num) spi_Isr(void) {
于 2019-05-07T01:53:20.573 回答