Novice questions about ICs, compilers & programmers

Discussion in 'Embedded Systems and Microcontrollers' started by agroom, Mar 12, 2012.

  1. agroom

    Thread Starter Active Member

    Oct 15, 2010
    I just started getting into embedded programming. I come from a CS background, so programming and using compilers are pretty natural (though making .exe not .hex). Our class is using a PIC 18F4520 chip on a prototype board (called the BoogieBoard) we made last semester and use MPLAB IDE2 and CSS PIC-C compiler.

    I'm very excited about this and have not been this gung-ho over something in a long long time! Unfortunately the class is going much slower than I anticipated, so I began looking online for fun starter projects I can do. I found a few I liked and ended up getting a few chips from PICAXE and atnel. I also have an Arduino Uno.

    After reading all the info for the PIC, PICAXE, Atmel and Arduino, all the various ICs, programmers and compilers started to get way too confusing! To be honest, I'm not even sure what I'm even all confused about yes since I'm a little overwhelmed by it all.

    To start with, here's some of the base-line things I've gathered:

    • Microchip (PIC) & Atmel (AVR) are kind of the two defacto brands/manufactures of microchips. Honestly, I don't know if there are any other, these seem to be the only two I've heard (* for hobby/home use).
    • You can get chips that are completely blank or ones that are 'bootstrapped' (?).
    • Bootstrap code is a special kind of program that lives on the chip that lets the chip program itself.
    • Chips without bootstrap code need to be programmed some other way.

    • Embedded compilers turn your code into machine language (.hex). I'm pretty familiar with this having done windows programming for years.
    • There seem to be dozens of compilers and each focus on being specific to one kind of thing. i.e. CCS focuses on the PIC line of chips
    • They all seem to be rather expensive unless you buy something from like Arduino that makes their own free for download.

    • These basically write the .hex file to the chip
    • They include some kind of hardware that connects to the chip and software to program it with.
    • The hardware is basically an interface between your software/computer and the chip and typically requires a driver to function properly

    It seems like I have a good grasp of this all, but my confusion all came in when I began using more than one kind of chip.

    The ardunio uses one piece of software available for free. It compiles and programs the chip all in one application. The hardware portion of the programmer must be built into the board then?

    The PICAXE chip also uses only a single free software application to compile and program its chips. The only hardware you need is their USB cable which has the hardware programmer built-in, and a simple circuit on your dev board.

    I'm not very familiar with the BoogieBoard other than the chip that is uses. I also know our school built a custom USB driver/adapter for it so it works just like the Arduino, you just plug the USB cable in and go. The programmer we use from Microchip is MPLAB and is free to download. The compiler though is not free, and so far the only way I can write code is at school where they have a license.

    I only recently bought the Atmel chips for a project I found and have been reading on how to program them. It seems I need to get something similar to the USB cable for the PICAXE, which I found one for $22, ~same as the PICAXE. I also don't know what to use for this chip to both program or compile.

    So my real confusion and frustration comes down to the whole programmer and compiler issue. I'm just a hobbyist/student and can't afford a compiler for my BoogieBoard, so one school ends that's probably done. Is this also going to be the case for my AVR chips?

    What does everyone here use for compilers and programmers? Unless I buy something from like PICAXE or Arduino, are they always going to be separate from each other? Will I have to pay for a compiler too? Are there any all-in-ones for the PIC or AVR chips? I also can't figure out how to do debugging. As far as I can tell I can't set breakpoints, watch variables, etc. like I could when doing windows programming.

    Anyway, I think that's probably enough to digest. Thanks for any help and for taking the time to read all of this!
  2. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    Hey agroom, welcome to the boards!

    You ask a lot of good questions. What I can tell you generally is it is best for your own sanity to try to stick to one micro controller at a time (least you remember details from one chip and try to do things that way on another). Also for sanity stick to one manufacturer (or even one manufacturer's series of devices) again so you have a smaller set of common features to learn.

    I have not worked with PICAXE or Atmel or Arduino, but they are all excellent choices. Arduino is a bit more oriented to the hobby/educational market, which can be a big plus to start off (they have lots of "shields" full of good hardware to buy and plug in, but not a way to go for a production item (someone may correct me there).

    I do work a lot with Microchips PICs. They give away some very good tools (IDE, C compilers, libraries) to use with their products. Some limitations apply but none that bother me as I am able to produce real legal product code using them.

    The board you have look like a good platform to begin with. Microchip also has two beginning sets, for the PICkit 2 or the
    PICkit 3. The 2 is the earlier version and doesn't (and may never) cover some of the newer devices, while the 3 is newer and covers everything they make. Each comes with a small development board and some lessons. I believe the 2 is devoted to assembly, and the 3 to C examples, but do check them yourself. With the dev boards they cost $50 and $70 USD each, respectively.

    What is so awesome about these programmers is they also work as in circuit debuggers, meaning you can watch, stop, and check the code as it is running on your hardware. That is a major item of importance.

    As a programmer alone they are just about production capable. I have used them as such when I could not justify the $800+ bill for their "production rated" programmer.

    What is bootstrapping? It is a way to upload code into your device without a programmer. A small program is the bootloader, and it can load code thru the USB for your device to run, meaning you don't need a programmer. However, in circuit debugging is not possible with such a scheme. The boogie board does have a display that can be sued to dump some debug info, but it is not as efficient as running a read debugger. Note: some programmers CAN do in circuit debugging, as they contain a close of the (open source) PICKit programmer!

    The on board PIC18F4520 is a little old but a very good device. It should be possible to modify the board to sue the PICKits on it. It may very well already have the connections for it as the manufacturer used that to install the bootloader code.

    Once you begin to get familiar with how things are done then by all means, try other processors!
  3. cravenhaven


    Nov 17, 2011
    Whew! thats a lot of different things to learn at once, I can understand why you've got yourself a bit confused.
    I agree with Ernie, its better to use just one of them until you understand how it works and then move to the others to understand the differences and advantages of each.
    As I understand it, PIC and AVR are broadly similar so for the time being choose one and stick with it.
    With the PIC you need a programmer of some sort such as the PICKIT2/3 or one of the many development boards available from a range of manufacturers including Microchip. The development tools are mostly free for hobbyist use eg: Microchips MPLAB, 'C' compiler and assembler are all free to download unless you want to upgrade to the professional versions. There are a number of other compilers and IDE's available as well, just search through this forum for details.
    The PICAXE chips dont require any specialised hardware. The download cable is a normal serial cable with just 3 wires used and can be made yourself. As most computers these days dont have serial ports it can be more useful to use a USB to serial adapter which are commonly available. The IDE for these chips is called Programming Editor and is freely available and includes an excellent simulator to test your code. The chips are PIC devices programmed with a Basic Interpreter. When programming the chips the PE 'tokenises' the code and loads it onto the chip (The Interpreter includes a downloader for your code). The onboard Interpreter then runs the code.
  4. nigelwright7557

    Senior Member

    May 10, 2008
    Its like old saying "Jack of all trades, master of none"

    Personally I stick to the PIC as I was a PIC consultant for many years and know the dev kit very well. Microchip do a formidable range of PIC's of which I have only used a few.
  5. MrChips


    Oct 2, 2009
    That's a lot of questions and answers to have to deal with all at the same time. Like a kid walking into the candy store and having to make a choice for the very first time. No wonder you are confused.

    And don't expect a simple answer. Most of the statements you make are almost true but some are misconceptions.

    Microchip PIC and Atmel AVR are popular choices but there are many others, including Freescale and Intel. As others have said, it is best to stick with one manufacturer and one family for now until you get a clearer understanding about microcontrollers (MCU).

    You have to ask yourself if you want to learn intimately how MCUs work or are you just interested in making them do fun things. In this respect, do you want to learn to program in assembler (ASM), ASM and C, or just C alone?

    You can download free tools and development software, ASM and C-compilers for just about every MCU available.

    You do not need a bootstrap program to program the MCU. Every MCU provides its own mechanism for programming. Some come with an internal bootstrap for this purpose. Many now have a simple serial interface that is used for both programming and debugging, ISP (In-System-Programming) and JTAG (Joint Test Action Group) are two examples.

    The simplest way to get started is to purchase a starter kit from the manufacturer. Microchip, Atmel and Freescale all have low-cost starter kits under $50.

    Choose one for now just to get the hang of it. You can explore the rest later. Everyone has their favorite. Twenty-five years ago most people went with the Intel/IBM/Microsoft combo and ignored the Mac. Look where Apple is today.

    Since you are already using the PIC18F4520 at school I would start out with the PICkit 2 Debug Express (Part # DV164121). It comes with everything you need to get programming.
    Last edited: Mar 12, 2012
  6. agroom

    Thread Starter Active Member

    Oct 15, 2010
    I'll try to add a little more now that I have some feedback, but I'm a bit short on time to address many of the replies atm. It might seem weird that I have such an array of chips, but here's how it happened.

    I graduated with a B.S. in CIS about 12 years ago and 2 years ago began taking night classes at the local tech for electrical engineering technology. Because of my programming background, embedded was my goal. I got impatient so about a year ago I bought an Arduino Uno and began playing around with it. Unfortunately since I didn't know much about building circuits yet, I was very limited

    Finally I'm in my first embedded class and within 3 weeks I finished all the course material. Since I already knew programming there was only a small amount of actual 'embedded' info introduced. We'd built the BoogieBoard in the previous class and so the school focuses (at least for now) on using the PIC chip.

    However, once I finished all the material, things just started to click, so I went online and began looking for projects. I wanted to keep them dead simple and someone suggested PICAXE. So I got the starter kit to just try and test out a simple chip, but also picked up the SpaceWriter to have a little fun too :)

    I was surprised at how easy the 08M2 chip was to program/interface and how dead simple the SpaceWrite was. Next I wanted to see if I could modify the SpaceWriter to use RGB leds, so I began researching those.

    On the way I stumbled across an instructibe on making RGB pixels (BlinkM clones). I thought this looked very cool and the DIY per/pixel cost was very attractive. They used the Atmel ATTiny45 chips which were only ~$1.50ea. As I began reading though I got more and more into how they're programmed and how I needed even more equipment and software and that it didn't see like any were compatible.

    All that confusing then placed me here! I'd probably be just fine sticking with the PIC chips, but I already ordered the ATTiny45s and LEDs, and the CYZ_RGB firmware only works with those chips. Plus it said I can flash the chip with my Arduino (maybe). The PICAXE chips are also just so dead simple to program and takes next to nothing o build them into a circuit.

    Having said all that and from what everyone said, I think I'm going to do two things.

    1) Probably stick with the PIC chips as my primary focus. It's what we're learning in school so it makes the most sense to parallel that.

    2) While I'm still learning the PIC, do my hobby stuff with the PICAXE. It's just so dead simple, all the software is provided and I already bought the programming USB cable.

    It's apparent that I had no idea what I was getting myself into! haha