Jump to main content
MPLAB XC-DSC C Compiler User's Guide
Search
Notice to Development Tools Customers
1
Preface
1.1
GNU Free Documentation License Notice
1.2
Conventions Used in This Guide
1.3
Recommended Reading
2
Compiler Overview
2.1
Device Description
2.2
Compiler Description and Documentation
3
Compiler and Other Development Tools
4
How To's
4.1
Installing and Activating the Compiler
4.2
Invoking the Compiler
4.3
Writing Source Code
4.4
Getting My Application to Do What I Want
4.5
Understanding the Compilation Process
4.6
Fixing Code That Does Not Work
5
XC-DSC
Toolchain and
MPLAB® X IDE
5.1
MPLAB® X IDE
and Tools Installation
5.2
MPLAB® X IDE
Setup
5.3
MPLAB X IDE
Projects
5.4
Operation Summary
5.5
References
5.6
Project Setup
5.7
Project Example
6
Compiler Command-Line Driver
6.1
Invoking the Compiler
6.2
The Compilation Sequence
6.3
Runtime Files
6.4
Compiler Output
6.5
Compiler Messages
6.6
Driver Option Descriptions
6.7
MPLAB® X IDE
Toolchain Equivalents
7
Device-Related Features
7.1
Device Support
7.2
Device Header Files
7.3
Stack
7.4
Configuration Bit Access
7.5
Using SFRs
7.6
Bit-Reversed and Modulo Addressing
7.7
Using EDS - dsPIC33C/E/F and dsPIC30F Devices Only [DD]
7.8
Stack Usage Guidance
8
Differences Between
MPLAB® XC-DSC
and C Standard
8.1
Divergence from the C Standard
8.2
Extensions to the C Standard
8.3
Implementation-Defined Behavior
9
Supported Data Types and Variables
9.1
Identifiers
9.2
Integer Data Types
9.3
Floating-Point Data Types
9.4
Fixed-Point Data Types
9.5
Structures and Unions
9.6
Pointer Types
9.7
Literal Constant Types and Formats
9.8
Standard Type Qualifiers
9.9
Compiler-Specific Type Qualifiers
9.10
Variable Attributes
10
Fixed-Point Arithmetic Support - dsPIC33C/E/F and dsPIC30 Only
10.1
Enabling Fixed-Point Arithmetic Support
10.2
Data Types
10.3
Rounding
10.4
Division By Zero
10.5
External Definitions
10.6
Mixing C and Assembly Language Code
11
Memory Allocation and Access
11.1
Address Spaces
11.2
Variables In Data Space Memory
11.3
Variables in Program Space
11.4
Parallel Master Port Access [DD]
11.5
External Memory Access
11.6
Extended Data Space Access [DD]
11.7
Dataflash Memory Access [DD]
11.8
Dual Partition Memory Access
11.9
Packing Data Stored in Flash [DD]
11.10
Allocation of Variables to Registers
11.11
Variables in EEPROM Data Space (Device Dependent)
11.12
Dynamic Memory Allocation
11.13
Co-Resident Applications
11.14
Memory Models
12
Operators and Statements
12.1
Built-In Functions
12.2
Integral Promotion
13
Register Usage
13.1
Register Variables
13.2
Changing Register Contents
14
Functions
14.1
Writing Functions
14.2
Function Size Limits
14.3
Allocation of Function Code
14.4
Changing the Default Function Allocation
14.5
Inline Functions
14.6
Memory Models
14.7
Function Call Conventions
14.8
Internal Functions
15
Interrupts
15.1
Interrupt Operation
15.2
Writing an Interrupt Service Routine
15.3
Specifying the Interrupt Vector
15.4
Interrupt Service Routine Context Saving
15.5
Nesting Interrupts
15.6
Enabling/Disabling Interrupts - dsPIC33C/E/F and dsPIC30 Devices Only [DD]
15.7
ISR Considerations
16
Main, Runtime Startup and Reset
16.1
The main Function
16.2
Runtime Startup and Initialization
17
Mixing C and Assembly Code
17.1
Mixing Assembly Language and C Variables and Functions
17.2
Using Inline Assembly Language
17.3
Predefined Assembly Macros
18
Library Routines
19
Optimizations
19.1
Optimization Feature Summary
19.2
How to Enable Optimization
19.3
Using Optimizations
20
Preprocessing
20.1
C Language Comments
20.2
Preprocessing Directives
20.3
Predefined Macro Names
21
Linking Programs
21.1
Default Memory Spaces
21.2
Replacing Library Symbols
21.3
Linker-Defined Symbols
21.4
Default Linker Script
22
Implementation-Defined Behavior
22.1
Translation
22.2
Environment
22.3
Identifiers
22.4
Characters
22.5
Integers
22.6
Floating Point
22.7
Arrays and Pointers
22.8
Registers
22.9
Structures, Unions, Enumerations and Bit-Fields
22.10
Qualifiers
22.11
Declarators
22.12
Statements
22.13
Preprocessing Directives
22.14
Library Functions
22.15
Signals
22.16
Streams and Files
22.17
tmpfile
22.18
errno
22.19
Memory
22.20
abort
22.21
exit
22.22
getenv
22.23
system
22.24
strerror
23
Embedded Compiler Compatibility Mode
23.1
Compiling in Compatibility Mode
23.2
Syntax Compatibility
23.3
Data Type
23.4
Operator
23.5
Extended Keywords
23.6
Intrinsic Functions
23.7
Pragmas
24
Common C Interface
24.1
Background - The Desire for Portable Code
24.2
Using the CCI
24.3
C Language Standard Refinement
24.4
C Language Standard Extensions
24.5
Compiler Features
25
Diagnostic Pragmas
26
Diagnostic Messages
26.1
Errors
26.2
Warnings
27
GNU Free Documentation License
28
Built-in Functions
28.1
Built-In Functions vs. Inline Assembly
28.2
Built-In Function Descriptions [DD]
29
Document Revision History
29.1
Revision B (April 2024)
29.2
Revision A (October 2023)
The Microchip Website
Product Change Notification Service
Customer Support
Product Identification System
Microchip Devices Code Protection Feature
Legal Notice
Trademarks
Quality Management System
Worldwide Sales and Service