CodeLoader is a bootloader for Microchip PIC Microcontrollers written in CCS PIC-C. A sampling of pre-compiled HEX files and full source code is provided. CodeLoader is copyright Gary Smithson of but may be freely used and distributed with the copyright notice intact.

Generally speaking, a bootloader is an application that remains resident in a microprocessor and accepts a compilers output file as an ASCII stream, parses it, and updates the program space accordingly. Any microcontroller is a candidate for utilizing a bootloader if it has both a serial communications interface (SCI/UART) and self-programming program space (FLASH/EEPROM). Bootloaders provide firmware developers with an easy and quick method of replacing the firmware in a microcontroller without the use of a device programmer. In fact, the microcontroller will not even be removed from the prototype circuit, which typically saves a significant amount of time and reduces the opportunity for electrostatic discharge.

CodeLoader is written specifically for Microchip PICmicros that have a serial communications interface and self-programming program memory. A typical device that meets these criteria is the PIC16F877. When prototype hardware containing CodeLoader powers-up or is reset, it checks for a valid downloaded program. If a previous download was successful then the user program is executed. If there is no valid user program then CodeLoader prompts for download. The download prompt may also be invoked manually at any time through a predefined trigger sequence during PICmicro reset (pressing and holding the host computer "=" key). CodeLoader works with your favorite terminal emulation program and does not require a download manager to be installed on the host computer. At the download prompt, simply transmit your program's HEX output file as an ASCII text file. Progress messages will be displayed during the download. The user program will begin automatically if the download is successful.


  Bootloading is easily performed in-circuit.
  NO circuits or cables required if used with our PIC Prototyping Board.
  Does not require a hardware trigger pin to invoke the download prompt.
  Does NOT affect user source code (except for available space) - Program as if it weren't there!
  Works with any firmware generation tool that provides a long jump for the reset vector and fills program space sequentially from low to high memory.
  Self-protects so that large user applications do not over-write it.
  All resources are released after download and available to the user application.
  Writes to Program FLASH and/or Data EEPROM.
  Reduces wear on FLASH and EEPROM by writing changed data only.
  Full error checking for confident operation.
  Successful downloads start user application automatically.
  Failed downloads automatically prompt for download.
  Only uses three wires for communication - TX, RX, and ground.
  Does not require handshaking hardware due to XON/XOFF protocol used.
  Downloads at 19,200bps.
  Fully transparent after successful download.
  Does not require a special download management PC application.
  Works with Windows HyperTerminal which is already loaded on most PCs.
  Works with any OS that provides a dumb terminal type application.
  RS232 applications which make use of a dumb terminal will perform immediately after download (if user application uses 19,200bps).
  Highly adaptable/maintainable CCS PIC-C source code provided.
  Can be compiled for many combinations of crystal speeds and PIC family members.
  Can be compiled to report to the Watch-dog Timer.
  CodeLoader is free to all who are willing to keep the copyright notice intact.


  Larger footprint than typical bootloader due to C source, full error checking and messaging.
  (All bootloaders) Fuse Settings and ID Locations can not be modified.
  (All bootloaders) Extra level shifting circuit is typically required for serial communications.
  (All bootloaders) In harsh electrical environments bootloaders may become corrupted.
  (All bootloaders) The bootloader itself must be programmed into the device on a traditional device programmer (hobbyist who do not have a device programmer often use our CodeLoader Programming Service).

Terminal Emulation setup:

In addition to the usual settings of 19200-8-N-1, there are two other very important settings;
XON/XOFF handshaking and Line Delay, which should be set to 10 milliseconds.

Prototype hardware setup:

PIC Prototyping Board:
  1. Install a jumper from prototype strip position 7 to 12.
  2. Install a jumper from prototype strip position 8 to 11.
  3. Plug the RS232 serial cable into jack A.
  4. Install a PICmicro programmed with CodeLoader into the appropriate ZIF socket.
Other: (typical example)
  1. A level shifting circuit such as a MAX233 is required to interface a PICmicro to the host computer.
  2. Provide power to the MAX233 from the PICmicro prototype hardware.
  3. Connect MAX233 TXin to PICmicro RC6/TX.
  4. Connect MAX233 RXout to PICmicro RC7/RX.
  5. The MAX233 circuit should include a Female DB9 connector.
  6. A Serial Port Extension Cable can be used to connect the MAX233 circuit to the PC COM Port.
  7. Install a PICmicro programmed with CodeLoader into the prototype hardware.

Mid-Range Family Download:

High-Range Family Download:

The CodeLoader software is presented free for download.
If you find it worthy of compensation, please make a donation.
Make a Donation

Related Items:

CodeLoader Programming Service
PIC Prototyping Board
PIC-C Compilers with Windows IDE (PCW)

keywords: Code Loader, Bootloader, Boot Loader, Bootload, AN851, AN732

ince 1992, theByteFactory has provided high quality software and firmware solutions at the technically advanced level that today’s products require and consumers demand.

We have expertise in the fields of Factory Automation and Monitoring using peer-to-peer networked nodes, embedded firmware development with a variety of microcontrollers and languages from Assembly to C, Windows applications ranging from local stand-alone to Distributed COM, and the development of multi-product Automatic Test Equipment.

home | products | services | download | contact | site | links | webrings