Microchip MPLAB® X IDE (Part 4 Hello World in Linux) (PIC18F16Q20)

The purpose of this article is to present a Hello World project for the PIC18F16Q20 CURIOSITY NANO board shown here,

image

Please proceed to install the compiler XC8 per previous article in the MPLAB X IDE before proceeding with these steps. Please verify proper installation as follows,

/opt/microchip/xc8/v3.10/bin$ ./xc8-cc --version
Microchip MPLAB XC8 C Compiler V3.10
Build date: Aug 13 2025
Copyright (C) 2025 Microchip Technology Inc

Add the path to this compiler in the Linux system. Please download the Hello World project pic18f16q20-nano-digikey-hello-world.zip (1.2 MB) and extract it to a directory of preference. Please open the main.c source code file

This program will display via the USB port to the host that ASCII image and it will blink the on board LED depending on the BLINK_DELAY parameter (in this case 50 mS). Now navigate to that directory and build the project as follows,

digikey_cofffe_cup@  make build

...
...
18F16Q20 Memory Summary:
    Program space        used   CA6h (  3238) of 10000h bytes   (  4.9%)
    Data space           used    58h (    88) of  1000h bytes   (  2.1%)
    Configuration bits   used     Dh (    13) of     Dh words   (100.0%)
    EEPROM space         used     0h (     0) of   100h bytes   (  0.0%)
    ID Location space    used     0h (     0) of    40h bytes   (  0.0%)


Once it is properly built, then attach the PIC18F16Q20 CURIOSITY NANO board to the USB. At this point depending on the configuration of the Linux system it should automatically mount and display the curiosity nano,

Open a minicom terminal,

digikey_coffee_cup@ sudo minicom -D /dev/ttyACM0

Welcome to minicom 2.10

OPTIONS: I18n 
Port /dev/ttyACM0, 13:04:31 [U]

Press CTRL-A Z for help on special keys

Program the PIC18F16Q20 CURIOSITY NANO board with the HEX file (This HEX file will be located in the project folder here: pic18f16q20-nano-digikey-hello-world/dist/free/production) from that folder proceed as follows,

digikey_cofffe_cup@  cp pic18f16q20-cnano-out-of-the-box-mplab-mcc.X.production.hex /media/engineer/CURIOSITY

The minicom terminal should display the following,

also the on board LED should be flashing as shown in the next video,

At this point the Hello World demo for this board in Linux is complete. Stay tuned for our next articles for the PIC18F16Q20 CURIOSITY NANO and the PIC16F13145-CNANO which are low cost evaluation platforms and are available at DigiKey.

Have a great day!

This arfticle is available in spanish here.

Este artículo está disponible en español aquí.

1 Like