eint( )

Use: eint( )
Description: Enables all interrupts
Returns: None
Related: dint(), interrupt_setup(), interrupt_disable()

Use the eint( )  command after setting up interrupts using the interrupt_setup( ) command this will enable the interrupts to start. Until the eint( ) command is run no intrrupts will run.


# The interrupt function flash_led is defined in the same way as any other mpy function
def toggle_led():   
    # First operation is to reset the interrupt flag for P1_3, this allows new interrupts to occur 
    global x
    x = ~x       # x is the on/off value for the Led , toggle its value  
    out(P1_0,x)   # Turn the LED on or off

# Main code
x = 0             # variable holding the LED state, set it off to start with
dirout(P1_0)      # set the REDLED pin as an output
dirinpu(P1_3)     # set the switch as an input with a pullup resistor
interrupt_setup( P1_3, RISE, toggle_led)    # setup a Rising pin interupt on P1_3, which will run the flash_led function 
eint()            # Enable the global interrupt switch. No interrupts will happen until this has been set