This is only a preview of the November 2026 issue of Silicon Chip. You can view 40 of the 104 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Items relevant to "NeoPixel RGB LED Analog Clock, Part 1":
Articles in this series:
Items relevant to "Portable EMF Probe":
Items relevant to "Ideal Bridge Rectifiers":
Items relevant to "Mighty USB-C Bench Supply, Part 2":
Purchase a printed copy of this issue for $15.00. |
New PICs and free compilers
Microchip
VS Code IDE
We use microcontrollers from Microchip Technology in many of our projects; for over
15 years, we have used the MPLAB X IDE to develop the firmware. Now Microchip has
released an MPLAB Extension for VS Code IDE. We’ll look into that, plus the latest
microcontroller peripherals from Microchip.
by Tim Blythman
A
n IDE (integrated development environment) is a program that can be used to develop software. Many years ago, we used separate text editors, compilers and programming apps to do this task, but an
IDE brings these together into a single, integrated environment, making
development easier (many IDEs also
include an in-circuit debugger).
There are also IDEs for native software development (eg, writing Windows software on a Windows computer). However, this article will focus
on IDEs for microcontroller firmware
development.
The MPLAB X IDE is a typical example. It allows you to create projects,
edit and compile code, upload firmware to a target device and even run a
debugging session to inspect the inner
workings and memories of a project
as it runs.
MPLAB X IDE also offers features
such as syntax highlighting, autocompletion and error checking. These
sorts of tools require the IDE to be
aware of the programming language
and the structure of your project, but
can be incredibly helpful in picking
up errors early.
MPLAB X is based on the NetBeans
IDE, which was originally intended for
the Java language.
The following description may be
easier to understand if you have had
some previous experience with software IDEs and working with microcontrollers, and thus will be familiar with the terminology we will use.
If you come across terms you’re not
familiar with, you may want to look
them up on the internet.
VS Code
Visual Studio Code (VS Code) is an
IDE developed by Microsoft that was
first released in 2015. VS Code can
be used with a variety of languages
and has the ability to install so-called
extensions to expand its functionality.
According to industry surveys, it has
been ranked among the top development tools in recent years.
We first noted VS Code in the
March 2025 issue, when we introduced the Raspberry Pi Pico 2 microcontroller module (siliconchip.au/
Article/17796). This hardware release
coincided with the porting of the C
SDK (software development kit) for
Raspberry Pi microcontrollers to the
VS Code platform.
In our review of the PICkit BASIC
programmer and debugger (September
2025; siliconchip.au/Article/18849),
we noted the release of the MPLAB
Extension Pack for VS Code. This
allows VS Code to be used as an IDE
for project development for PIC microcontrollers and other Microchip Technology parts. That article also noted
Fig.1: the splash
screen for a recent
version (6.30) of
MPLAB X IDE hints
at the rise of the
MPLAB Extension
for VS Code.
Fig.2: VS Code’s
Activity Bar allows
quick access
to features and
extensions.
VS Code
Explorer
Search
Source Control
Run and Debug
Extensions
MPLAB
MPLAB AI Coding Extension
58
Silicon Chip
Australia's electronics magazine
siliconchip.com.au
Fig.3: the MPLAB Extension Pack includes a few different elements (listed at left) to provide the features needed within an
IDE.
the inclusion of an AI coding assistant.
Recent versions of the MPLAB X IDE
seem to indicate (Fig.1) that VS Code
will be the main IDE in the future. Of
course, older versions of MPLAB X
and even its MPLAB IDE predecessor
are still available from the Microchip
archive at siliconchip.au/link/abpn
Like MPLAB X IDE, VS Code is
available on multiple platforms,
including Windows, Linux and
macOS. VS Code can be installed on
inexpensive Raspberry Pi computers
(which are effectively Linux computers with ARM processors), but it does
not appear to be officially supported
on that platform.
In this article, we will investigate
the steps needed to install the MPLAB
Extensions in the VS Code IDE to
allow working with PIC microcontrollers and explore some features of VS
Code. Then we’ll report on some other
Microchip news, including new parts.
Using VS Code
We found that VS Code was easy
enough to use, although it does several
things very differently to MPLAB X,
and there are some MPLAB X features
that are still lacking. So it could be
somewhat of a learning curve to make
the change. We started by downloading it from https://code.visualstudio.
com and installing it.
siliconchip.com.au
The Activity Bar at upper left is a
good place to start exploring – Fig.2
shows the Activity Bar and the functions of its buttons. You may not see
the lower buttons immediately, since
they will be added when the MPLAB
Extensions are installed.
To install the MPLAB Extensions,
click on the Extensions button and
search for “MPLAB”. Then install
the MPLAB Extension Pack, as seen
in Fig.3. This includes several other
bundled extensions that are needed.
Note that VS Code supports both ‘light’
(black text on white background) and
‘dark’ modes; we have used a mix of
screenshots to demonstrate this.
Like the MPLAB X IDE, compilers
are installed separately. We already
had some compilers installed to work
with MPLAB X IDE; we did not have
to do anything for VS Code to detect
and use these. If you need to install
a compiler, we suggest installing the
latest compilers from siliconchip.au/
link/acd7
For example, if you plan to work
with 8-bit PIC microcontrollers (PIC12,
PIC16, PIC18), you should install the
XC8 compiler. For 32-bit parts like the
PIC32 chips used in many Micromites,
you should install the XC32 compiler.
We also found that we did not need
to install tool packs (for programmers)
and device family packs (DFPs), which
Australia's electronics magazine
also appear to have been detected after
being installed by the MPLAB X IDE.
You may see a prompt at the bottom
right corner of the VS Code window to
install these or other software dependencies.
VS Code also has a strong security
focus. So you might also see prompts
to ‘trust’ a folder. This should be fine
for MPLAB projects, but be aware that
VS Code can also work with code that
can run on the host computer. So be
cautious about trusting other projects,
especially those that can run natively
on your computer.
Getting started
Click on the MPLAB button on
the Activity Bar and open the Welcome page from the Help → Welcome
menu, if it is not already showing.
That should show a button for Getting Started with MPLAB. Click on
that and you should see a screen like
Fig.5. This page is a good base from
which to navigate until you become
more familiar with VS Code.
You can open an MPLAB X project
if you have previously used MPLAB
X to create one. Our firmware downloads for construction projects involving microcontrollers often include the
MPLAB X projects and files, so you
could download and experiment with
one of those.
November 2026 59
Fig.4: the Command Palette is a VS Code
feature that provides access to search,
as well as allowing commands to be
entered as text.
Fig.5 (below): the MPLAB Welcome
Screen provides some useful starting
points for PIC projects within VS Code.
Fig.6: even at the start of a chat
with the MPLAB AI Assistant, it is
analysing the project files to provide
insights into how to improve the code.
MPLAB Extensions for VS Code uses
a different project format, so changes
made in VS Code are not reflected
in the MPLAB X project properties,
although changes to the source code
are. We generally made copies of our
projects so that the changes made by
the two IDEs did not conflict.
The Explorer (top button of the
Activity Bar) should show the various files associated with the project.
Most of the project properties are
held in JSON files in a “.vscode” subfolder. JSON files are in text format and
are generally human readable, so they
60
Silicon Chip
can be edited if necessary. The Projects section of the MPLAB activity also
shows the hierarchy of the JSON file
and clicking on a field will open up a
user-friendly view that resembles the
Project Properties windows from the
MPLAB X IDE.
VS Code makes use of ‘Workspaces’,
which generally include a project
folder in their scope, although other
folders can be added. The File menu
contains options relating to Workspaces.
You can drag-and-drop the buttons
from the Activity Bar, as well as other
sub-windows, and move items around
to customise the work area. There are
buttons to toggle the two sidebars and
many more layout options under the
View menu (Appearance and Editor
Layout submenu items).
Another interesting tool is the ‘Command Palette’, which looks like a
search box at the centre top (by default)
of the VS Code window. Fig.4 shows
the drop-down that is seen when you
click on the Command Palette.
You can use the key combinations
shown in Fig.4 to enter text into the
Command Palette to search for a file,
symbol or text or to run a command. It
also shows handy defaults and recent
Australia's electronics magazine
actions. It’s a powerful way to access
features when you are constantly using
the keyboard while coding. Also see
https://aka.ms/vscodekeybindings
Using the MPLAB Extensions for VS
Code is straightforward enough, and
we found most of the problems we ran
into were due to unfamiliarity with
the layout and environment. We had
no trouble compiling, using ‘>build’
in the Command Palette to perform a
“MPLAB CMake: Build”.
The MPLAB panel (selected from
the Activity Bar) should show any
connected programmers under the
Tools dropdown. You can also use the
Run menu to access programming and
debugging options.
MPLAB AI Coding Assistant
To use the AI Assistant, you will
require an API key, which in turn
requires a free Microchip Technology
account; this can be created at https://
login.microchip.com
Once you have set up the account
and logged in, you can copy the API
key from www.microchip.com/ai-
assistant/accesskey
You will also need to have the
Microchip Chatbot selected and using
the MPLAB Agent.
siliconchip.com.au
Fig.7: the AI Assistant can also suggest code changes that can be accepted or rejected, as shown here. Note how we have
asked it to keep, but comment out, the old code for reference. This view shows dark mode (white text on black).
Opening the AI chat window from
the Activity Bar should prompt for the
API key if it is needed. The interface
is much the same as other AI chatbots,
where you type in a question or prompt
and the AI agent processes the query
and responds. Sometimes it will pause
and ask for permission to review an
online resource.
Context is important, so we started
our chat (Fig.6) with a brief statement about the relevant facts that
related to our project and asked for
a review. The analysis stretched for
a few pages beyond what is shown
here. It included several correct observations and some suggestions of what
to work on.
Fig.7 shows the end result of two
further prompts. The first prompt
was a request to modify a function to
change the Peripheral Module Disable (PMD) registers so that only the
IOC (interrupt on change) peripheral
is enabled; this is done to minimise
siliconchip.com.au
power consumption in sleep mode
while allowing sleep to be ended by
a pin change interrupt.
The AI Assistant made an appropriate suggestion, and the editing window
provides the option to reject or accept
the change in place. Instead of accepting, we asked it to comment out the
old code instead of replacing it; the
result is shown in Fig.7 and accepted
as looking correct to us.
We were similarly able to generate
startup code to switch off the PMD registers. The AI Assistant was asked to
scan the code for peripheral usage and
suggest appropriate values to enable
only the peripherals that are used by
the code.
Its assessment of the necessary
peripherals was quite good, although
it did take a bit of troubleshooting to
get the exact values needed. In this
case, the AI Assistant was helpful in
suggesting troubleshooting strategies
such as disabling each peripheral, one
Australia's electronics magazine
at a time, to try to identify the problematic case.
We found that the AI Assistant was
quite helpful in avoiding the tunnel
vision that can sometimes occur during
troubleshooting and could suggest
alternatives to those that had been considered. It’s almost like having someone else to share the problem with.
Sometimes the responses are quite
long-winded! There is the constant
proviso that AI can make mistakes;
sometimes, its apparent verbosity can
appear overconfident. At one point, it
asked, “Let me know if you want this
change directly committed to your
project, or have further optimization
questions!” We wish we had that sort
of enthusiasm!
We think that these applications are
where the AI Assistant will be useful.
Attempting to manually generate the
necessary commands from the register bit fields in the datasheet can be
tedious and error-prone, while the
November 2026 61
AI Assistant can streamline it. It also
seems handy at generating things like
bulky or repetitive code.
The code that was generated
appeared to be well-formatted with
detailed comments, so could be used
to improve code readability. The AI
Assistant was also helpful when we
had questions about the VS Code environment and could even access data
sheets and project configuration files
to respond to queries.
Other notes
Just like MPLAB X IDE, there is
an MCC (MPLAB Code Configurator)
extension for VS Code. We don’t use
MCC much for our projects since we
have specific library files and drivers
that we use, so we did not have much
need to test it out.
We could not easily find a way to
install and check tool (programmer)
packs and DFPs (device family packs).
These are the software profiles that are
necessary to work with specific programmers (such as PICkits) or microcontroller families.
It appears that the DFPs are automatically installed if needed when a new
project is created. Quite a bit of automatic downloading occurred, so we
could not easily see how much storage
space various features required. Otherwise, packs that are installed through
the MPLAB X IDE are automatically
detected in VS Code.
We observed that some of the extensions have notes that “Features and
functionality will remain in active
development”, so it appears that the
MPLAB Extensions environment is
still not complete, at least compared
to MPLAB X IDE.
We also could not find (within
MPLAB Extensions for VS Code) a
tool for setting up configuration fuses
or viewing memory contents, except
for individual variable watches in a
debugging session. These aren’t things
that we need often, but are invaluable
when they are available.
XC8 compiler 4.00
While we were writing this article, we saw that version 4.00 of the
XC8 Compiler had been released. The
notes for XC8 also mention improvements relating to debugging support
for assembly code and improved tools
and diagnostics.
The changelog doesn’t indicate any
fundamental changes, but the note
that XC8 has now “Removed license
restrictions for optimization features”
is quite an understatement!
Why do we use so many PICs?
You may be wondering why we use so many PICs in our projects. Why not an Atmel AVR
chip, an STM32 from ST Micro, an NXP microcontroller, or something else? We do sometimes publish projects using those other chips and many of them work well enough.
While Microchip Technology advertises in the magazine, that isn’t contingent on us
using their devices. The reason is partly historical. We’ve used PICs for decades and have
lots of experience with them. However, it’s mainly because we like working with them.
A given PIC may not be the fastest chip or the best in every way, but there are a few
things they do consistently well. They’re often inexpensive, with more flash and RAM
than similarly priced competing chips. That means we don’t have to stress so much
about making our program fit.
They’re also pretty easy to program once you have the hardware, which will work
with just about any PIC. Jumping from an 8-bit PIC to a 16-bit or 32-bit device takes
very little effort. Plus, Microchip offers a wide range of devices, from tiny and cheap
to big and powerful.
We also find that the some aspects of PIC programming (such as the configuration
bits) are simple and elegant. We are currently producing an article comparing 8-bit PIC
and AVR parts and their configuration bits, which are handled quite differently. Importantly, we only need a small range of hardware to make the pre-programmed microcontrollers we sell in our Online Shop.
PICs also tend to have excellent peripherals, many of which can be mapped to different pins. That includes things like PWM, hardware serial, good ADCs, DACs, comparators, programmable logic blocks and more. Other micros have those things too, but
some we’ve tried had pretty sparse peripherals, limiting what we could do.
In addition to PICs, we have also used Raspberry Pi Picos in a few projects as they
have some great features too. We have also been impressed with some of the features
of the STM32 chips Andrew Levido has used in his projects; we could imagine using
those one day as well.
62
Silicon Chip
Australia's electronics magazine
This effectively means that the
previously PRO level optimisations
(which could only be accessed with a
paid licence) are now free to all users.
This applies to all XC compilers and
now makes the -O3 (optimise favouring speed) and -Os (optimise favouring size) options for the XC8 compiler
available at no cost.
Most of our projects have deliberately avoided the PRO level optimisations so that our readers do not need to
pay for a licence to compile our code,
although there have been a handful of
cases where this has been necessary.
Fig.8 shows the Compiler section of
the Project Properties under VS Code.
While the higher (“3” and “s”) optimisations are available for selection in
earlier versions, they will fail on older
compiler versions, since these still
implement the licence checks that have
been removed from XC8 version 4.00.
New chips
It has been a while since we last
reviewed a new family of Microchip
microcontrollers. We investigated the
PIC16F181xx family of parts (along
with some others) in October 2022
(siliconchip.au/Article/15505).
Since then, we have used the 20-pin
PIC16F18146 in many projects. For
projects where smaller chips have
been required, we have also used the
14-pin PIC16F18126 and the 8-pin
PIC16F18115. These have many
handy analog features, including an
8-bit DAC (digital-to-analog converter)
and a 12-bit ADC (analog-to-digital
converter), as well as many digital
peripherals.
We noticed the introduction of the
PIC16F131xx family of parts a few
years ago but did not have the opportunity to do much with them at the
time. This family of chips includes a
CLB (configurable logic block) peripheral. The PIC16F132xx family has just
been released, and it too includes the
CLB peripheral.
CLB
Previously, we have used the CLC
(configurable logic cell) peripheral
that is featured in the PIC16F181xx
family. The CLC can be used to set up
logic that can operate independently of
the core processor. The CLC could be
considered equivalent to adding one
or two simple logic ICs, such as logic
gates or perhaps a latch, to a microcontroller.
siliconchip.com.au
For example, it can be used to
mix the outputs of two peripherals
to generate signals that cannot be
directly created by existing peripherals. Nicholas Vinen’s RGB LED Star
from December 2025 (siliconchip.au/
Article/19372) used the CLC to create
waveforms to control WS2812-based
LEDs. This combined a PWM signal
with an SPI signal to suit the specific
timing needed for these chips.
The CLB has some similarities in
that it can be used to combine peripherals via logic to work with unusual
signals. However, it is much more
advanced and is more like a CPLD
(complex programmable logic device)
than a simple logic chip. So it can emulate much more complex logic.
The CLB is based on a unit known
as a BLE (basic logic element), seen
in Fig.9. There are 32 BLEs available
in all PIC16F131xx and PIC16F132xx
parts. Each BLE incorporates a four-
input LUT (look-up table) to provide
combinatorial logic, plus a latch to
allow sequential logic, such as shift
registers.
Building blocks like these BLEs
are common to many programmable
logic devices, including FPGAs (field-
programmable gate arrays). There are
some project examples using the CLB
at https://mplab-discover.microchip.
com/v2?dsl=clb
Unlike other peripherals, the CLB
requires a substantial amount of data
to be initialised. Each of the 32 LUTs
requires 16 bits of data to determine
the LUT output for each of the 16 combinations of four bits at its input. There
are also bits that determine where the
inputs and outputs are routed so that
complex logic can be developed from
connecting multiple BLEs.
Many peripherals might have a
handful of byte-sized registers to set
up, while the complexity of the CLB
requires its registers to be supplemented by an entirely different system.
Complex programmable devices store
their data in a so-called bitstream, and
it is the way this bitstream is loaded
that is unusual.
The PIC16F13xxx (PIC16F131xx
and PIC16F132xx) parts also include a
CRC (cyclic redundancy check) memory scanner that can scan through the
non-volatile flash memory and confirm
(using a CRC code) that the memory
has not been modified or corrupted.
The CRC peripheral has an alternative mode that can scan a part of flash
siliconchip.com.au
Fig.8: recent versions of the XC compilers allow use of the “3” (-O3) and “s”
(-Os) options that were previously restricted to paid PRO licence holders.
Fig.9: the CLB peripheral on the PIC16F132xx family contains 32 of the BLE
blocks seen here. The LUT can be used to make combinational logic (including
AND, OR, NOT, XOR gates), while the latch can be used for sequential logic,
such as memory and shift registers.
memory and transfer the contents to
the hidden registers that configure
the bitstream of the CLB. So this step
is used to load the bitstream from
non-volatile flash memory into the
working memory of the CLB.
In a typical application, the on-chip
firmware would perform a bitstream
load sequence and set up any I/O pins
or internal peripherals to connect to
the CLB. Finally, the processor would
activate the CLB peripheral so that it
is active.
The PIC16F132xx parts also have
the ability to load the bitstream at
startup and then halt the processor,
effectively becoming a pure logic
device.
Generating the bitstream
There are some handy tools available to turn a conceptual design into a
functional bitstream, including a user
Australia's electronics magazine
interface that can be used to lay out
logic elements in a graphical fashion
and then synthesise a design into a bitstream. The tool can be found at https://
logic.microchip.com/clbsynthesizer
Fig.10 shows the tool editing a 12-bit
linear feedback shift register (LFSR),
which can be used to generate pseudo-
random values. It has no inputs and the
eight most significant bits are available
as outputs. The OR gates are necessary
to trap the all-zeroes state that might
otherwise cause the LFSR to latch up.
The outputs can be mapped to different pins via the PPS (peripheral pin
selection) module.
The synthesis tool requires internet access, since Microchip’s servers
host the software that is needed. Internally, the tool uses the Verilog HDL
(hardware description language) and
modules can be created with snippets
of Verilog. The open-source Yosys
November 2026 63
Fig.10: you can try out the CLB Synthesiser tool on the Microchip website, even if you don’t have an IDE installed. The
design shown here implements a 12-bit LFSR (linear feedback shift register) that can generate pseudo-random data.
framework is used for digital logic
synthesis.
The bitstream download also
includes other synthesis files and some
C code to initialise the CLB. There have
been some efforts to analyse and provide alternative means to generate the
bitstream. You can see one project at
https://mcp-clb.markomo.me
Other features
This family also includes a 10-bit
DAC. We’ve found the 8-bit DAC on
the PIC16F181xx family quite handy,
so we may investigate this family further for future use. The CLB feature is
also available on PIC16F131xx parts,
as we noted earlier.
The first members of the PIC16F132xx
family were the larger (28-, 40- and
44-pin) chips, which may be useful
in the case of projects that require
microcontrollers with more I/O pins.
We have recently seen the announcement of 8-pin, 14-pin and 20-pin parts
in this family.
The PIC18-Q35 family also includes
CLB peripherals. PIC18 parts have an
8-bit processor, like the PIC16 parts,
but are generally more powerful. Interestingly, the CLB in these parts has
128 BLEs, so they can implement even
more complex logic.
The CLB is certainly a fascinating
peripheral, and we can see that it has
a lot of potential. The larger parts may
64
Silicon Chip
be handy if we need more I/O pins for a
project. Concepts like LED and switch
matrix scanning with many I/O pins
are likely to be well-suited to handling
by CLB logic.
So far, we have not found a compelling project use for the CLB peripheral.
With the recent release of 20-pin parts
in this family, we may see the likes of
the PIC16F13246 as a drop-in successor to the PIC16F18146 that we have
used so often.
PDID
PDID stands for Programming and
Debugging Interface Disable. As the
name suggests, it can be used to lock
down the programming interface,
preventing programming, debugging
and erasure of the chip. This feature
is present on the PIC16F132xx family
of microcontrollers and is set by the
ICSPDIS configuration bit.
Crucially, once the ICSPDIS bit
has been enabled, it cannot be disabled and the device cannot be reprogrammed by an external programmer or debugging tool. It is clearly
intended to be a security measure
to prevent firmware tampering. Of
course, this feature should be treated
with absolute care, since it cannot be
disabled.
Interestingly, these parts still allow
other methods for modifying their
flash memory, so it is possible to allow
Australia's electronics magazine
firmware updates. The internal NVM
(non-volatile memory) controller can
write to flash memory, and thus the
firmware can implement a bootloader
to allow updates. But that can only
occur if the firmware has been written to allow this.
Conclusion
With the Raspberry Pi Pico Extension for VS Code being the official
way to use the Pico C SDK, we expect
that we will be using VS Code more
as time goes on.
The MPLAB Extension for VS Code
IDE looks to be very useful, although
it appears that some features present
in MPLAB X IDE are not yet available
in VS Code. For now, we will use both
the MPLAB X IDE and VS Code for PIC
programming. Having both installed
will also streamline the addition of
tool packs and device family packs.
One thing we like about the VS Code
IDE for Microchip devices is that it’s
quite a bit faster than MPLAB X IDE
as it does not rely on Java.
We found the AI Assistant to be helpful in many cases. It even has the ability
to make changes directly to code, so it
would be entirely possible to write the
bulk of a project through AI prompts
only. Like many AI implementations,
the AI Assistant is not perfect and
can make mistakes, so it is a tool that
SC
should be used with care.
siliconchip.com.au
|