PIC vs AVR?

Here's my plan for the future:

Use pre-built Arduinos as training wheels to learn more about this general subject.

Eventually move on to making my own stuff, with either PIC or AVR. If I stay using AVR, I might be able to keep the Arduino programming language. Can I install the Arduino bootloader on any AVR processor? If so I am MOST CERTAINLY sticking with AVR forever and using Arduino, just not on a board I buy off the internet. I'd design my own Arduino board.

But I've heard a lot about PICs and I'm curious about them too. If I can't slap Arduino onto any AVR microcontroller I'm really 50/50 on what type to use.

Is programming on a non-Arduino microcontroller relatively the same? Do I just use C? I hope it's similar to the Arduino language. Or is it some weird graphical language? (I hope not ._.) Is it different between PIC and AVR?

Can I program either of them with my current UNO?

Thanks.

The "Arduino language" is actually C++ with some libraries.

You can not put the bootloader onto any AVR but on most. If you want to build your own stuff an ISP is a much better choice. ISPs are cheap, actually cheaper than an Arduino. Even the very good AvrispMKII is not much more expensive than an Arduino.
The only reason to start with an Arduino instead of a plain AVR is that it is so much easier. Looking at your questions you are completely unexperienced. Thus Arduino would be a good choice for you.

With regard what you can achieve with PIC vs. Arduino the differences are negligible unless you have much more experience. Once you have enough experience the actual controller does not really matter anymore. Basically they are all more or less the same. Only the details (pin count, memory, frequency, power consumption, price ...) are different :wink: The skills for dealing with them are the same.

The C compiler for the PIC is not free, it is quite expensive. You can also program a PIC in assembly language. Graphic programming languages are much higher up the food chain.

Okay. But can I put the Arduino bootloader onto any AVR microcontroller?

You can and it will work on some as well.

Grumpy_Mike:
The C compiler for the PIC is not free, it is quite expensive. You can also program a PIC in assembly language. Graphic programming languages are much higher up the food chain.

This isn't quite true anymore, from what I understand:

http://www.digilentinc.com/Products/Catalog.cfm?NavPath=2,892&Cat=18

The compiler for that product is supposedly "free" and based off of gcc. Now of course, I don't know if this compiler only works with that product, or if it works across a range of the PICs (maybe the immediate family for the particular PIC used?) - or if it works more broadly (I highly doubt it works across the entire PIC line, though)...

:slight_smile:

The C compiler for the PIC is not free

There are free and low-cost C compilers (and other languages) for PIC. The old 8-bit PICs aren't very C-compatible in their architecture, and the compilers are mostly not as good as avr-gcc (used by arduino) is for the AVR. For the he 16 bit PICs (pic24xx, pic30xx, pic33xx) and the 32bit PICs (PIC32), a version of gcc IS one of the free options. (they're generally much nicer, but not what people mean when they talk about programming PICs.)

But can I put the Arduino bootloader onto any AVR microcontroller?

No, but I'm not sure that this is a good question. You don't need the Arduino bootloader on an AVR chip for it to run arduino sketches...

westfw:

But can I put the Arduino bootloader onto any AVR microcontroller?

No, but I'm not sure that this is a good question. You don't need the Arduino bootloader on an AVR chip for it to run arduino sketches...

I was not aware of this. How do you put an arduino sketch onto an identical (or not) microcontroller that doesn't have the bootloader? What does the bootloader DO then?

Chicken325:
How do you put an arduino sketch onto an identical (or not) microcontroller that doesn't have the bootloader?

ISP ... In System Programmer.

An Arduino can be turned into one... http://arduino.cc/en/Tutorial/ArduinoISP

You can buy a dedicated one...
http://www.google.com/search?q=avr+isp&tbm=shop

My personal favourite...

What does the bootloader DO then?

Mimics the behaviour of an ISP.

Nice... this didn't turn into one of the Apple x Microsoft thread. :slight_smile:

What does the bootloader DO then?

It allows the system to be programmed by a simple serial connection and does all the waggling about of signal wires in order to programme the flash memory inside the controller. If you have some external piece of hardware that does that instead then you don't need a boot loader.

The reason why it won't work on every processor is that it makes assumptions like how much memory there is and where it is. On some processors you will need to modify the boot loader to make it work on others the concept of a boot loader will not work because on these you can't run a program and change flash locations at the same time. The memory needs to be segmented in order to do this. The space available to put a boot loader in is limited.

Different processors use different machine code and you can't just put the machine code of one processor into another, well you can but it won't work.

Once you understand the arduino, it's not a big leap to start programming AVR chips with an ISP and AVR Studio.

JimEli:
Once you understand the arduino, it's not a big leap to start programming AVR chips with an ISP and AVR Studio.

I think the problem most people face is really not understanding the entire concepts of the "Arduino" hardware and what's inside the different libraries.

i have been watching this thread with interest - my project should become commercial within a year if it all goes to plan

however i am concerned i have limited my future options by decisions i make today :roll_eyes:

I have already been led up the garden path by another hardware solution, and don't want to waste any more time

does any one on here prefer pic - is the language similar to C ?

Your future is always limited by any decision you take today. Sometimes more sometimes less. Unless you tell us what kind of project you are pursuing you will get no answers better than this.

Depending on your project Arduino may or may not be suited. Who knows. However I would bet that not everything will go to plan. It never does.

is the language similar to C

No processor runs C, it is just the source code for the compiler uses to generate the machine code the processors run. In that respect the PIC can use C just like the arduino or any other processor with a C compiler.
Note the PIC is not one processor, it is a whole load of totally different processors, so you can't just talk about a PIC as if it were one thing.

i would be interested to know if many guys swap from pic to avr and vice versa

does anybody know much about PICaxe

Gadget999:
i have been watching this thread with interest - my project should become commercial within a year if it all goes to plan

Did you go on Dragon's Den??? LOL

Gadget999:
however i am concerned i have limited my future options by decisions i make today :roll_eyes:

I have already been led up the garden path by another hardware solution, and don't want to waste any more time

Here's my two cents. Again, you did not provide any information about your project, so any advice I or any other person gives you is generic and may not be the right one for your application/project. But hopefully will make you understand a few things needed for you to make an informed decision.

AVR uses a free compiler that is at least 10 (or more) years old. PIC C compilers for free are quite new and there isn't many of them. So when it comes to compilers, I guess the cheapest most reliable solution is on the AVR side.
In terms of chips, I don't think there's a bootloader available for PIC microcontrollers that is widely available as the Arduino. So again, if you're planning to make a project, going with an AVR chip will most likely be a lot faster to get it going.

In terms of hardware, I don't see as many boards available for PICs as I see for the Arduino platform. So, if you're planning to use some peripheral hardware, the AVR wil be easier to get ahead with less investment and headache, compared with the PIC.

In terms of reliability, they're both good and the most important aspect on the reliability is the software and the hardware design and not the chip itself.

In terms of price, they are similarly priced... but, if you need to buy a compiler that cost will be important considering the amount that you're planning to sell.

So in the end, the question if PIC is better than AVR boils down to two things:

  • Does one brand provide some in-chip hardware or format (CAN bus, USB comm, higher true speeds, smaller package, wireless communications, etc, etc...) that the other one doesn't.
  • Which chip is more familiar to the project team or designer?

Gadget999:
does any one on here prefer pic - is the language similar to C ?

I think this is the wrong place to ask... we're mostly biased towards AVR. I know I am.

i would be interested to know if many guys swap from pic to avr and vice versa

Yes, I came over from PIC, mostly because at the time, there were no hobbyist-grade C compilers available for it, only assemblers (though there was a free simulator) and I got bored and frustrated debugging assembly code on the eccentric paged memory model.
Sure as Hell wouldn't go back.