Wednesday, May 26, 2010

PIC Programmers

Got my parts today, and finally started building and testing my programmer. I was actually amazed at how few changes I had to make to get it working - there was two problems with the MCLR signal, and everything else is working nicely. Next I have lots of testing to do with peripherals, but at least I got the "hello world" LED to turn on and off. Schematic is updated, and can be found at:

Also took a couple pictures of the current setup. Here is my programmer, with the Arduino XBee shield beside looking pretty.


Finally, how do I program the PIC? This is a slightly complicated process...
  1. Download the required software. I have found success with ICProg (http://www.ic-prog.com/), with MPLabs IDE and their C18 compiler (Lite/Student)
  2. Setup your project in MPLabs according to their tutorials/user manuals. Get all the include files necessary for the C compiler to compile and link, and build. This generates a hex file.
  3. Run ICProg. First time setup will require you to also download and run the XP/2000/NT driver (icprog.sys) if you are using one of these OS. Not sure if it works for Vista or 7, and no idea what a good Unix hex programmer is.
  4. Side note: ICProg also allows you to do hardware tests. This sets the serial pins hi or lo for you to test your programmer's response with a DMM.
  5. Select your PIC (or other MCU), programmer (mine is similar to a JDM) and use the Windows API setting. I have I/O delay of 4. Com 1 is the serial port on my comp. Usually 1 and/or 2 are serial ports. Hit the Program All button!
  6. This will take some time (maybe a minute) and will put your program onto the micro. Unfortunately with my circuit the data only goes one way so it can't verify. Hope to fix that with my last opto-coupler for the next iteration.
I know those weren't super detailed instructions, but all of those steps individually are well documented in forums, blogs etc. its just getting the correct order and a full set of hardware and programs that work together that is the tricky part. This one seems to work pretty well for me.

Next steps for me will be verifying the other peripherals (wireless, ultrasonic) and getting them working with the PIC, and mounting the whole thing on a more portable and nicer looking protoboard and inside a box where it can't be destroyed. Then back to the Arduino to write some mapping algorithms!

No comments:

Post a Comment