10. interrupts
#include< LPC21xx.h> void enable_interrupts(void) { __asm { MRS RO, CPSR // Move the current program status register to RO BIC RO, RO, #0x80 // Clear the I bit in CPSR (enables IRQ) MSR CPSR_C, RO // Move the modified value back to CPSR } } void disable_interrupts(void) { __asm { MRS RO, CPSR // Move the current program status register to RO ORR RO, RO, #0x80 // Set the I bit in CPSR (disables IRQ) MSR CPSR_c, RO // Move the modified value back to CPSR } } int main (void) { disable_interrupts(); // Disable interrupts enable_interrupts(); // Enable interrupts }