Skip to content

Wiz-IO/XC16

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 

Repository files navigation

Microchip XC16 PlatformIO

16 bit Arduino ( PIC24, PIC30, dsPIC33 )

( The project is a work in progress, there may be bugs... )

If you want to help / support or treat me to Coffee paypal

pic

Framework source: https://github.com/Wiz-IO/framework-XC16

COMPILER

Platform use installed XC16 compiler
For now I use 1.50 ( NOT tested with a larger version. )

  1. Install XC16 v1.50 from the Microchip website

  2. Install C++ Compiler ( need for CPP projects and Arduino )
    https://github.com/fabio-d/xc16plusplus
    https://github.com/fabio-d/xc16plusplus/releases

Extract to xc16/v1.50/bin/bin:

  • elf-cc1plus (Linux and OS X) or elf-cc1plus.exe (Windows)
  • elf-g++ (Linux and OS X) or elf-g++.exe (Windows)

Copy/Paste/Rename ( or symlink ):

  • bin/xc16-cc1 to bin/ xc16-cc1plus
  • bin/xc16-gcc to bin/ xc16-g++

3. Uploader use "libusb-1.0.dll" https://github.com/libusb/libusb/releases
Put DLL in PlatformIO Python folder ( .platformio/penv/Scripts )

4. Install Platform:
(VSCode) PlatformIO Home > Platforms > Advanced Installation: paste https://github.com/Wiz-IO/XC16

Problems ?

In general, C projects ( Baremetal ) should work without problems ( any XC16 versions )
Should work on Linux & Mac too ... no idea, me: Windows
ATTENTION Arduino API is 32 bits, XC16 is 16 bits ( int )
Recommended chips for Arduino & C++ with 32k RAM
I have on hand:

  • PIC24FJ256GB206
  • PIC24F16KA301
  • dsPIC33FJ12GP201

so, the experiments are with this boards

Debugging

Challenge, but in some other life...

UPLOADER

Integrated uploader, based of reverse engineering of PicKit4 ( GEN4 ) protocol
must work with PicKit4, Snap... etc

Note: for Windows need "libusb-1.0.dll"

Demo: https://www.youtube.com/watch?v=PiL7RAr3POE

Backup plan B - use MPLAB IPE ( PicKit etc ) - Load HEX, Program

INI

[env:WizIO-PIC24FJ256GB206]
platform = XC16
board = WizIO-PIC24FJ256GB206
framework = Arduino ; or Baremetal

;custom_xc16 = C:\Program Files\Microchip\xc16\v1.50 ; select custom version, default is 1.50

;custom_heap = 8129 ; change other

monitor_port = COM26
monitor_speed = 115200

Baremetal

is just a platform name of the C projects here
for CPP projects, rename main.c to main.cpp

Arduino

Support: Basic Arduino API, some pins, Serial, Wire, SPI... etc, in process...
Note: SPI phrase is used from Microchip SDK, so, the library use Spi

Example

#include <Arduino.h>

void blink()
{
    static unsigned int i = 0;
    static uint32_t begin = millis();
    if (millis() - begin > 200)
    {
        begin = millis();
        digitalToggle(LED);
    }
    if (++i > 60000)
    {
        i = 0;
        Serial.print("MILLIS: ");
        Serial.println(millis());
    }
}

void setup()
{
    Serial.begin(115200); // pins 11 & 12
    Serial.println("PIC24F Hello World 2022 Georgi Angelov");
    pinMode(LED, OUTPUT);
}

void loop()
{
    blink();
    if (Serial.available() > 0)
    {
        Serial.print("CHAR: ");
        Serial.write(Serial.read());
        Serial.println();
    }
}

gif


If you want to help / support or treat me to Coffee ( 12 Year Old Whisky ) paypal

About

Microchip XC16 PlatformIO

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages