Most devices have built in interrupts users can call by using the Interrupt flowchart icon.
Interrupts can be used to temporarily pause the operation of the microcontroller and allow something more urgent to happen before continuing where it left off.
- 1 Timer Interrupts
- 2 INT Single Pin Interrupts
- 3 IOC (Interrupt On Change) Multiple Pin Interrupts
- 4 RXINT UART Receive Interrupts
Timer interrupts are useful for monitoring the passage of time. Whether you want something to happen on a regular tick or simply want to measure how long something has taken a timer interrupt can prove to be very handy tool.
Example program showing how to generate software PWM to drive multiple LEDs. Here we have a knight rider effect using eight LEDs. Each LED has a duty value between 0 (off) and 63 (bright on).
Quadrature Encoder using Timer Based Polling
Example program showing how to use a quadrature encoder component using a polling method via a timer interrupt.
RGB LED Control using Timer
Example program showing how to control a RGB LED using a timer interrupt to set the LED refresh rate, uses three analogue sliders to set the output colour (PWM duty) of the R, G and B LEDs.
INT Single Pin Interrupts
The INT type interrupts allow you to monitor the state of a single port pin.
Normally you can choose if the interrupt macro is called when the port pin state changes on the rising edge or falling edge.
Counting Pulses using INT
Example program showing how to use a single pin interrupt (INT) to count the number of pulses arriving on an input pin.
IOC (Interrupt On Change) Multiple Pin Interrupts
The IOC type interrupts allow you to monitor the state of a number of port pins.
Different chips have different levels of IOC support ranging from a few pins on the chip to all of the pins.
Chips with advanced IOC support allow you to choose the pins you wish to use using the IOC interrupt properties.
If any of the enabled pins change state then the interrupt macro is triggered.
Quadrature Encoder using IOC
Example program showing how to use a quadrature encoder component using a interrupt on pin state change interrupt (IOC).
Counting Multiple Pulses using IOC
Example program showing how to use a interrupt on pin state change interrupt (IOC) to individually count the number of pulses arriving on input pins.
RXINT UART Receive Interrupts
The RXINT interrupt allows the interrupt macro to be called whenever a byte is received by a hardware UART channel.
Communications Bridge Using UART RXINT
Example program to listen for incoming bytes on the UART, any bytes that are received are placed into the circular buffer ready to be processed. In this case forwarded onto a computer using the USB serial connection.