HighSchoolRobots.com

The cheapest way to get into robotics
Home
Site Map
Why JAL?
Getting started with JAL
Tiny Bootloader
Serial Cable
VHS Cassette bot
Servo controller board
Downloads
Contact Us
Your first JAL program
Jal 2 Using variables
Jal 3 FOR loops and ports
Jal 4 IF THEN and 7 segme
Jal 5 Inputs and WHILE lo
Jaluino servo shield
Cheap Serial LCD
In order to speed up the development cycle and make your life easier, you may want to program your PIC using a bootloader. I have used the Tiny bootloader and found it works fine for me. Only PICs that are able to self program will work with Tiny bootloader. This includes the 16f88, the 16f877, and pretty much all the 18f chips. You need a regular programmer to load the bootloader firmware onto the PIC, but after that you just use a simple max232 and serial cable.

First you want to download Tiny bootloader
:  There is a windows program that runs on your computer. This is how you load your code. There is also a folder with firmware for the PIC. Use the high voltage programmer to load the hex file "tinybld16F88_i8MHz __19200.HEX" from the /picsource/16f folder onto your PIC. This assumes you are using the internal clock and not an external crystal to clock your 16f88. Then bring up the tinybootloader software and set it to 19200 baud.
 
You will then need a serial cable with a max232 voltage level converter. There are instructions and a schematic on the tinybld website and in the tiny bootloader download above.

With the bootloader installed, you just write your program, compile, connect the serial cable to the circuit, reset the PIC and tell the bootloader software to load the desired hex file. When the PIC is reset, it starts looking for a computer connected to the serial communications pins and if it hears an answer it will load the hex file from the computer. If it doesn't hear an answer from the computer it will simply start whatever program was already loaded previously. Below is a comparison of standard programming and bootloader programming.

 Pic has bootloader programmed in, and circuit is wired for max232 cable.

 

  • Write your code
  • compile
  • load .hex file into bootloader software
  • plug max232 cable into pic circuit
  • reset the pic and send .hex file
  • Voila!

Your program or compiler will need to be modified to accomodate a bootloader.  If you are using the Jalpack you can add the line pragma bootloader long_start  to your header to tell the compiler to add a long start command to the beginning of the code. This jumps to the bootloader at the end of the memory first and allows the bootloader to look for a computer to communicate with.Berts starter pack is already set up to do that so no change is needed.

 Pic has no program or old program that will be completely replaced. Write your code

 

  • compile
  • load .hex file into programmer software
  • pull pic out of circuit and insert into programmer
  • program pic
  • reinsert pic into circuit (don't bend the pins :)
  • Voila!

With a standard programmer you are free to use the MCLR pin for I/O rather than for a reset pin. This can be usefull in circuits where you need that extra pin. On the other hand it can get tedious pulling chips and reinserting them. An in circuit serial programmer (ICSP) can alleviate this pain, but is generally more complicated to wire up than a bootloader cable. On the other hand, the configuration fuses are available to the ICSP so you can change the oscillator type, brown out detection etc.  With all that being said, it is much more cost effective to build a bunch of cheap max232 cables for your students and just get one regular programmer to load the bootloader with. If you are a lone hobbyist, you might look into a standard programmer with an ICSP connector.