Skip to content
George edited this page May 29, 2019 · 3 revisions

In order for a program to be interrupted from it's normal workflow or sleep mode and jump to a specific function, an ISR or Interrupt Service Routine must be defined. CC430 supports interrupt vectors originating from a Pin, Timer, WDT, RF packet or RTC. By default, RF packets are received as an interrupt for processing. Arduino specific interrupt functions are supported within panStamp's NRG as well as AVR. Interrupt specific functions are as they follow:

timer1a0.attachInterrupt(function); //Timer1 based interrupt that calls the ISR 'function' when the timer overflows.
attachInterrupt(pin, function, mode); //Sets a specific 'pin' as an interrupt, then calls the ISR 'function' if the mode is reached. Mode can be RISING, FALLING or CHANGE. Alternatively but not recommended are the modes HIGH and LOW.
detachInterrupt(pin); //Stops the pin from being used as an interrupt vector.
noInterrupts(); //Disables all interrupts (GIE) including the RF interrupt.
interrupts(); //(Re)enables all interrupts (GIE) including the RF interrupt.

Notes:

  • sleep(), sleepSec() and delay() functions will all enable the interrupts (GIE) upon call.
  • It is recommended to use detachInterrupt(pin) before you perform a pinMode() inside the loop.
  • The only pins that can be uninterruptible are pins P1.x to P2.x or 0 to 15.

Anti Swap

API for Anti Swap

Clone this wiki locally