5.1 Introduction

Built-in functions give the C programmer access to assembler operators or machine instructions that are currently only accessible using in-line assembly but are sufficiently useful that they are applicable in a broad range of applications. Built-in functions are coded in C source files syntactically like function calls, but they are compiled to assembly code that directly implements the function and does not involve function calls or library routines.

The built-in functions are preferred by programmers more than in-line assembly, for the following reasons :

  1. Providing built-in functions for specific purposes simplifies coding.
  2. Certain optimizations are disabled when in-line assembly is used as compared to built-in functions.
  3. For machine instructions that use dedicated registers, coding with in-line assembly needs care to avoid register allocation errors . The built-in functions make this process simpler as user need not be concerned with the particular register requirements for each individual machine instruction.

The built-in functions are listed below followed by their individual detailed descriptions.

The compiler provides additional built-in functions for operations, such as writing to Flash program memory and changing the oscillator settings. Refer to the MPLAB® C Compiler for dsPIC® DSCs User’s Guide (DS51284) for a complete list of compiler built-in functions.