Building Blinky from scratch


After building a Blinky Grid kit for my nephew, I wanted to understand a little more about how the LEDs in the matrix were being lit. NOTE: Building the matrix by hand is not for someone looking for something easy. The kit was great and straight forward.

Now, I believe I have created the board, getting unique LEDs to light based on all the different High / GND combinations. The problem I am having is the burning of the 16F1823. My programmer is telling me that the blinky_firmware_bootloader_grid_combined_v1.02.hex (file downloaded from github) does not have the configuration bits. I’ve read the source files and THINK I have manually set the config bit in the programmer correctly. Should that HEX file completely write the PIC - ID, EEPROM, Data and Config? I would assume that the schematic minus the LED matrix and only having a couple opposing pairs of LEDS across LED1/LED2 & LED3/LED4 would flash a little if the chip was powered up. Is there anything about MCLR or Button that might have been left off the schematic? Should the sample LED pairs on a breadboard light from default power up? I should have kept the working kit so I could have tested my pieces.



My guess is that they designed this board with a version of MPLAB 8.xx that allowed you to program the config bits from inside the IDE. In other words, it let you bild a hex file without the config bits. In Microchip’s new IDE, MPLAB X, you can no longer do that.

You should be able to ask what they are supposed to be and recreate the hex file with the config bit settings.



Hi friends, thanks for the postings.

Adam and I both use Linux exclusively (I guess Adam uses OSX nowadays) so we haven’t really used MPLAB very much. We used the old HiTech PICC compiler for the blinky bootloader, since it had a freeware version and we could run it on Linux.

The final hex file is a combination of PICC-compiled C source code for the bootloader, and the assembly code is assembled using the mplabx “mpasmx” command line utility.

I did define the config registers in the source files, for both the bootloader and the userspace code.

; __config _CONFIG2, _LVP_OFF & _BORV_19 & _STVREN_ON & _PLLEN_OFF

// Config register CONFIG1
    FCMEN_OFF &             // Fail-Safe Clock Monitor is disabled
    IESO_OFF &              // Internal/External Switchover mode is disabled
    CLKOUTEN_OFF &          // CLKOUT function is disabled. I/O or oscillator function on the CLKOUT pin
    BOREN_OFF &             // Brown-out Reset disabled
    CPD_OFF &               // Data memory code protection is disabled
    CP_OFF &                // Program memory code protection is disabled 
    MCLRE_ON &              // MCLRE/VPP pin function is MCLR
    PWRTE_ON &              // PWRT enabled
    WDTE_OFF &              // WDT disabled
    FOSC_INTOSC             // INTOSC oscillator: I/O function on CLKIN pin

// Config register CONFIG2
    LVP_OFF &               // Low-voltage on MCLR/VPP must be used for programming
    BORV_19 &               // Brown-out Reset Voltage (VBOR) set to 1.9 V
    STVREN_ON &             // Stack Overflow or Underflow will cause a Reset
    PLLEN_OFF &             // 4x PLL disabled
    WRT_HALF                // 000h to 3FFh write protected, 400h to 7FFh may be modified

I’m not sure why the config bits didn’t make it into the hex files.


The code is posted to GitHub:

bootloader/ contains the bootloader.c file and build script

grid/ and pov/ contain the .asm files and script - The grid/pov build scripts also build the bootloader and uses hexmate to merge the two hex files into a single combined bootloader/userland hex file.

Let us know if you have questions!


After checking the grid combined hex file again, I found that my copy was goofed. Once I had verified I had the whole hex file, the programmer did not complain about missing config bits and my wiring monstrosity came to life. The grid displays perfectly and the bootloader lets me change the messages. It was when I tried to take the non-led portion of the circuit from breadboard to soldered board to make it my durable is I ran into trouble. The PCB you guys provide is top notch and very much worth the time and frustration of trying to solder everything together, but hey, I’m getting some good practice. Thanks again.