dsPIC33A Firmware Development Using VS Code®

Last modified by Microchip on 2026/04/07 10:23

Overview

On this page, we review available hardware and software tools to help you get started writing firmware for a dsPIC33A DSC using the MPLAB® Extensions for VS Code® development environment.

MPLAB Extensions for VS Code

MPLAB Extensions for Microsoft® VS Code is a collection of VS Code extensions that combines the power of the MPLAB development ecosystem with the versatility of VS Code. Whether you are a new or existing client, MPLAB Extensions for VS Code provides you with a seamless, flexible, and efficient development environment with comprehensive support for designs based on our devices. It's available for Windows®, macOS®, and Linux® platforms.

MPLAB EXT download

These extensions extend the functionality of VS Code, making it your one-stop shop for complete project management and integration with other development tools, such as compilers and programmer/debugger hardware.

Note: For more information on MPLAB Extensions for VS Code, please visit our Learn MPLAB Extensions for Microsoft Visual Studio Code (VS Code) page.

Back to Top

MPLAB XC-DSC Compiler Collection

MPLAB XC Compiler logo

The MPLAB XC-DSC compiler is a full-featured, optimizing compiler that translates standard American National Standards Institute (ANSI) C programs into dsPIC® Digital Signal Controller (DSC) device assembly language source code. The compiler also supports many command-line options and language extensions that allow full access to the DSC device hardware capabilities and provide fine control of the compiler's code generator.

The MPLAB XC-DSC compiler is a fully validated tool that conforms to the ISO/IEC 9899:1990 C programming language standard (referred to in this document as C90) as well as the ISO/IEC 9899:1999 C programming language standard (C99) for programming languages.

The compiler also supports many dsPIC DSC-oriented language extensions that allow full access to the DSC device hardware capabilities and fine control of the compiler's code generator.

Note: For more information on installing and licensing the MPLAB XC-DSC compiler, please review the Installing and Licensing MPLAB XC C Compilers document.

Back to Top

Bare-Metal C Application

Here is a simple, complete bare-metal C application for dsPIC33A, which toggles an LED every 500 ms. Let’s review the key components.

bare-metal C application for dsPIC33A

You must add #include <xc.h> at the top of the source code to access dsPIC33A registers using the C syntax shown in this example.


Next, you must use the #pragma config pre-processor directive to define specific hardware configuration bit settings appropriate to your application. In this example, the only setting we need to change from the defaults is to configure the watchdog timer to be disabled by default.


If your application uses interrupts, define them here using the pre-defined Interrupt Service Routine (ISR)​​​ function names found in the device data sheet. Here, we define a Timer1 Overflow ISR that toggles an LED connected to Port C pin 2.


Every C program needs a main() function, so we define one having no parameters and returning an int to the c-startup code. Note that you will not normally return from the main function.


In the first part of the main function, you need to initialize the clocks, and any other peripherals needed for your application. In this example, we are running off the default system clock settings after reset, which use the 8 MHz internal Fast RC Oscillator.


Finishing off our main() function, we have our while(1) loop code, which implements our main application logic and runs forever…in this case doing nothing but waiting for Timer 1 interrupts to occur.


Note that the xc.h file allows firmware to access/modify all bits in a control register in a single instruction.


Alternatively, firmware can access and modify individual bits or bit fields within a control register. This is enabled by the MPLAB XC-DSC compiler, which encapsulates dsPIC33A registers using C unions, where all the bits and bit fields are encapsulated using C structs.

Back to Top

MCC Melody Extension for VS Code

MCC Melody Extension for VS Code is a graphical plug-in tool for VS Code that assists you in developing 8-bit and 16-bit applications. It also supports application development with dsPIC33AK devices.

MCC Melody VS Code window

It helps configure devices easily, use peripherals, and includes libraries that help you generate application code quickly. It visualizes components’ dependencies to simplify development and offers easy maintenance by enabling content versioning at the driver level. You can easily migrate across MCUs with MCC Melody to keep up with your application needs.

Information

Note: The MCC Melody Extension for VS Code is installed during the MPLAB Extensions for VS Code installation process.

Back to Top

Development Boards

dsPIC33A Curiosity Platform Development Board (EV74H48A)

The dsPIC33A Curiosity Platform Development Board (EV74H48A) is a full-featured development and demonstration platform that enables customers to explore the capabilities of the dsPIC33A family:

EV74H48A board

The board operation requires the insertion of a 120-pin General Purpose Dual In-Line Module (DIM) containing a dsPIC33A DSC device (purchased separately), such as the dsPIC33AK128MC106 Curiosity GP DIM (EV02G02A) shown inserted above, or the dsPIC33AK512MPS512 Curiosity GP DIM (EV80L65A).

The board contains a built-in programmer and debugger. No external tools are necessary to program and debug the onboard dsPIC33AK device.

dsPIC33AK Curiosity Nano Evaluation Kit (EV17P63A)

The dsPIC33AK Curiosity Nano Evaluation Kit (EV17P63A) is a hardware platform to evaluate microcontrollers in the dsPIC33AK family. This board has the dsPIC33AK512MPS506 DSC mounted.

The board contains a USER LED and a USER SWITCH, along with a built-in programmer and debugger. No external tools are necessary to program and debug the onboard dsPIC33AK device.

dsPIC33AK device

Back to Top

Programmer and Debuggers

For stand-alone MCU programming and debugging from the VS Code Integrated Development Environment (IDE) to actual hardware, Microchip offers several in-circuit debuggers and programmers.

MPLAB PICkit™ Basic

The MPLAB PICkit Basic in-circuit debugger and programmer is designed to provide an ultra-low-cost, high-performance solution for programming and debugging Microchip PIC® and AVR® MCUs, dsPIC® DSCs, and SAM Arm® Cortex®-M based MCUs and MPUs.

MPLAB PICkit™ Basic in-circuit debugger/programmer

This debugger is compatible with MPLAB X IDE, MPLAB IPE, MPLAB VS Code extensions, and partner ecosystems like IAR Embedded Workbench using the CMSIS-DAP standard via the CMSIS-DAP-Switcher. The device offers advanced debugging capabilities and supports various debugging interfaces like 4-wire JTAG and Serial Wire Debug. The tool provides automatic device selection and includes an adapter for Arm Cortex targets.

MPLAB PICkit 5

The MPLAB PICkit 5 in-circuit debugger/programmer uses an 8-pin Single In-Line (SIL) connector interface. It’s designed to be a portable prototyping tool that enables production-ready programming for all Microchip devices—including PIC MCUs, dsPIC DSCs, AVR and SAM devices—and Arm Cortex-based microprocessors (MPUs).

MPLAB PICkit™ 5 in-circuit debugger/programmer

The PICkit 5 supports a wide variety of interfaces, such as four-wire Joint Test Action Group (JTAG) or Serial Wire Debug (SWD) with streaming UART Virtual Comm Port (VCP). With an added Debugger Adapter Board, the PICkit 5 can use standard connectors for JTAG, Serial Wire Debug (SWD), In-Circuit Serial Programming™ (ICSP™), and AVR protocols.

The PICkit 5 can be powered by the target board and can program a default image with a press of the button hidden under the logo sticker and by using the PICkit 5 stand-alone MPLAB Programmer-to-Go (PTG) mobile app. This allows you to connect to the tool from your smartphone via Bluetooth® and browse any application files stored on the tool's microSD™ card, then start programming the target board right from the app. 

MPLAB ICD 5

The MPLAB ICD 5 In-Circuit Debugger/Programmer is the next step up and offers advanced connectivity and power options for designs based on PIC, AVR, and SAM devices, as well as dsPIC DSCs. With its support for Fast Ethernet connectivity and Power over Ethernet Plus (PoE+), the MPLAB ICD 5 Debugger/Programmer offers flexibility and the convenience of remote development while isolating your application from environmental conditions. 

MPLAB ICD 5 In-Circuit Debugger/Programmer

Back to Top

Code Examples

Small code snippets are provided in the product data sheet to demonstrate certain peripheral configuration procedures.

In addition, MPLAB Discover provides you with a searchable database of code and project examples for all Microchip MCUs. By entering "dsPIC33A" as a search term, you are provided with a listing of code examples for dsPIC33A:

MPLAB Discover example search