Build PIC programmer

Discussion in 'General Electronics Chat' started by pillyg, Nov 20, 2011.

  1. pillyg

    Thread Starter Member

    Sep 19, 2011
    52
    0
    Hi, I have looked around a lot but haven't found what I am looking for. I am looking for a "complete guide" to programming a pic. That includes making a programmer and choosing what software you need to get started.

    I am a complete noob with MCUs. I have some pics (16f84a and 16f690) but no way to program them. I am looking at http://www.diylife.com/2008/02/15/program-a-pic-microcontroller/
    for my physical programmer. Will that work? I will use a USB to Serial cable to connect it to my computer. Will that work?

    For software, I have no idea. All I know is that I want to program in BASIC. What programmer and what compiler should I use? Is it even possible to program a JDM programmer with BASIC?

    Thanks

    William
     
  2. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
    If you are a complete noob with pics then save the hassle and buy a PICKit 2 or a PIC Kit 3. Don't try to build one. I suggest the PicKit 3.

    Microchip sells a great kit with programmer, demo board and lessons. It is how I got started and I am glad I did.

    They give you working sample code that works with the demo board. You can have something up and working in 5 minutes then spend the rest of the time learning how it was done rather than spending all of your time getting the programmer working.
     
  3. pillyg

    Thread Starter Member

    Sep 19, 2011
    52
    0
    I know about PICkit, but I thought it would be more fun to build one. I am mainly concerned about BASIC and PIC. Can a JDM programmer like the one I talked about do BASIC through a USB to Serial cable?
     
  4. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
    Buy a PIC Kit. Learn PICs THEN build your own programmer.

    Many of these programmers are just that programmers. The PicKit 2 and 3 offer in circuit debugging. This is a huge advantage.

    The PicKit 2 even offers a simple logic analyzer.

    Not sure why they did not offer that on the 3.
     
  5. pillyg

    Thread Starter Member

    Sep 19, 2011
    52
    0
    I am in High school and don't have a job so I don't want to spend the money on a $30 programmer when I could make one for about $2.

    I also dont want to do C since I already no a bit of BASIC.
     
  6. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
    You can program with BASIC, C assembler and maybe a few others with the PICKIt 2 and 3.

    I think you are under estimating the cost to build one unless you already have some of the parts on hand. A DB 9 connector alone can cost 2-3 dollars. You also need to factor in costs for making mistakes.
     
  7. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718

    Trust me when I say that you will only waste $2 and a lot of time (typically a good chunk of it being ours as well). PLEASE Get a PICKit 2 or 3 w/demo board for $50

    9 out of 10 programming problems people come here asking about are because they are using a DIY programmer, and their circuit works fine once they use a Microchip PICKit 2 or 3 programmer (NOT a clone!). Save a ton of headaches and wasted time and money by skipping the DIY programmer.

    The debugger, UART and Logic probe are bonuses in the PICKit 2 that I wish they'd add to the PICKit 3. Those "extras" alone are worth the price, and you get a debugger and programmer with it!
     
  8. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
    PIC programming is NOT easy. Yeah it is pretty easy to turn on an LED or two but when you start dealing with a more complete project using RTC, PWM, SPI, One Wire, LCDs your hands will be more than full figuring that all out. The last thing you want is to worry about a homemade programmer.
     
  9. pillyg

    Thread Starter Member

    Sep 19, 2011
    52
    0
    Alright. You have convinced me not to use PIC. I know this the complete opposite of the topic of this forum, but I will instead build an arduino. The arduino website has a great page on making one http://www.arduino.cc/en/Main/Standalone and I only have 2 questions. Instead of using the USB to serial breakout board, can I just use a USB to serial cable? Also, my friend has an arduino board so how can I burn the bootloader from his arduino onto another atmega 328 on a breadboard? I have no programmers.
     
  10. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
    Where did we do that?

    The arduino will be easier to use but it will be far, far more expensive than the PIC once you start to build projects. All of those little modules are expensive.
     
  11. pillyg

    Thread Starter Member

    Sep 19, 2011
    52
    0
    Well I don't want to spend $50 on a programmer and C is too complicated so the only other option was arduino.I know the arduino program has an option to program the bootloader using an arduino as the ISP but how would I do that? Would I just connect the 6 header pins on the arduino board the the correct pins on my breadboard arduino?

    Thanks
    William
     
  12. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Using an arduino, you are buying a programmer with every board, that's the gist of it.

    And the add on "Shields" are where lots of cash is made by the people who come up with them.

    For not wanting to spend money, you are finding ways to get rid of a bunch in a hurry.
     
  13. pillyg

    Thread Starter Member

    Sep 19, 2011
    52
    0
  14. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    6,357
    718
    Arduino is programmed in C, BTW.

    SwordFish Basic for PIC is free
     
  15. pillyg

    Thread Starter Member

    Sep 19, 2011
    52
    0
    Yes it is C. My mistake, I meant to say for the pics that I didn't want to learn assembly language which I couldn't understand at all.

    Along with the arduino parts, I will also buy the PIC programmer parts and if one doesn't work, Ill go to the other.

    The main question I have is can I use something like http://www.ebay.com/itm/New-USB-Ser...ultDomain_0&hash=item20bd223ebc#ht_2563wt_952

    instead of

    http://www.arduino.cc/en/Main/MiniUSB
    or
    http://www.sparkfun.com/products/718

    to connect the arduino to my computer.
     
    Last edited: Nov 20, 2011
  16. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
    How many times do I have to say it? You don't need to program in C for PICS. There are other options.

    You are worried about complicated and you wanted to build your own programmer?
     
  17. spinnaker

    AAC Fanatic!

    Oct 29, 2009
    4,866
    990
  18. pillyg

    Thread Starter Member

    Sep 19, 2011
    52
    0
  19. tracecom

    AAC Fanatic!

    Apr 16, 2010
    3,869
    1,393
    That's a cool project; I might tackle that on a larger scale - maybe find an old bell lyre somewhere to start with.

    No, there's another choice! And since you don't seem too sure what type of microcontroller you really want to learn with, I'll put in a plug for the PICAXE family. It's based on PIC's, but the PICAXE's are pre-programmed with a bootstrap code. The PICAXE programming software is free, the chips are relative cheap, and the programming circuit is simple. A complete programming setup can be based on a solderless breadboard. (See the attached photo.)

    PICAXE chips are available from 8 pins to 40 at prices starting under $3.00. If you have a serial port on your computer and a serial cable, you can make your own programming cable for cheap. Otherwise, you do have to have a USB cable which is a bit pricey (about $30.) There's a forum devoted to PICAXE's and lots of code already written that you can use or modify as you see fit. Check it out at http://www.picaxeforum.co.uk/forum.php .
     
    Last edited: Nov 20, 2011
  20. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,386
    1,605
    Real men use PICs (not Arduinos).

    Just sayin' :D

    Seriously, where you end up usually is determined by where you start. A PIC is a catch all term for micro controllers from little 5 pin SOT packages running a few hundred instruction on 8 bit words up to 100 pin 32 bit protected mode processors with up t 64K bytes RAM and a megabyte ROM. Once you can use a PIC you can drop in just the hardware your app needs. You can download free assemblers and C compilers from Microchip. Third party providers have sample versions of Basic to use (these free versions will be limited in the size of the program you can make).

    Most languages can integrate to MPLAB (also free) so you have one spot to write your code then test it inside your hardware thru a PICkit.

    I've helped a bunch of people get started. I strongly recommend you not only get a programmer/debugger (real Microchip PICkit 2 or 3) but some sort of development board also. These come in a bundle (PICkit & board) in either the Debug Express or the Starter Kit. Both are $50 and both come with a button, a pot, some LEDs, and a place to wire in your own parts, plus a set of 12 lessons to use a PIC on the hardware.

    Everything you need is in that box. I think it even comes with a USB cabel. The PIC board can be powered off the PICkit, and either board would be powerful enough to play songs like your nerdkit. They certainly have enough output pins to drive the solenoids without the shift registers.

    One of the worst times in life is when you have a new set of hardware and a new program and perhaps a new programmer, and something is not working but what is broken in that chain can take weeks to find.

    Simon sez don't do that.
     
Loading...