11.07.2015 Views

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

MSP430 IAR C/C++ Compiler reference guide - Rice University

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

FunctionsThis chapter contains information about functions. It gives a brief overview offunction-related extensions—mechanisms for controlling functions—anddescribes some of these mechanisms in more detail.Function-related extensionsIn addition to the ISO/ANSI C standard, the <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong> providesseveral extensions for writing functions in C. Using these, you can:●●Use primitives for interrupts, concurrency, and OS-related programmingFacilitate function optimization● Access hardware features.The compiler supports this by means of compiler options, extended keywords, pragmadirectives, and intrinsic functions.For more information about optimizations, see Writing efficient code, page 124. Forinformation about the available intrinsic functions for accessing hardware operations,see the chapter Intrinsic functions.Primitives for interrupts, concurrency, and OS-related programmingThe <strong>MSP430</strong> <strong>IAR</strong> C/<strong>C++</strong> <strong>Compiler</strong> provides the following primitives related to writinginterrupt functions, concurrent functions, and OS-related functions:●●●●The extended keywords __interrupt, __task, __monitor, __raw, and__save_reg20The pragma directives #pragma vector and #pragma no_epilogueThe intrinsic functions __enable_interrupt, __disable_interrupt, as wellas many othersThe compiler option --save_reg20.INTERRUPT FUNCTIONSIn embedded systems, using interrupts is a method for handling external eventsimmediately; for example, detecting that a button has been pressed.In general, when an interrupt occurs in the code, the microcontroller simply stopsexecuting the code it runs, and starts executing an interrupt routine instead. It isPart 1. Using the compiler 23

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!