Search code examples
avrpicavr-gccmicrochipxc8

In mplab xc8 IDE Is it safe use ei() the same way as the AVR Assembler sei()?


GIVEN: http://ww1.microchip.com/downloads/en/DeviceDoc/MPLAB_XC8_C_Compiler_User_Guide.pdf XC8's ei(); // Enable Global interrupts

XC8's di(); // Disable Global interrupts

and

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

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

Then its safe to say ei() == sei() && di() == cli() and can be used interchangeably when switching platforms?


Solution

  • That's a very general statement about the interrupt systems on the two chips. They are very different in many ways.

    That said, yes, the macros set and clear a single bit in a status register, so the macros operate the same way.