go away spammer

Author Topic: PIC vs AVR  (Read 42544 times)

0 Members and 1 Guest are viewing this topic.

Offline javafiendTopic starter

  • Robot Overlord
  • ****
  • Posts: 125
  • Helpful? 0
PIC vs AVR
« on: August 08, 2008, 10:29:45 AM »
It seems there are more books centered toward PIC microcontrollers and since I haven't worked with them, how difficult is it to take PIC projects and modify them for AVR microcontrollers?

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: PIC vs AVR
« Reply #1 on: August 10, 2008, 07:39:54 PM »
Depends on what the project is.

The code will definitely be different, the pinout will be different, but the schematics and concepts will be the same.

Offline JesseWelling

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: PIC vs AVR
« Reply #2 on: August 11, 2008, 01:01:24 AM »
Much of the high level code could be the same, it all depends on if such things were abstracted well enough to be portable.

Offline javafiendTopic starter

  • Robot Overlord
  • ****
  • Posts: 125
  • Helpful? 0
Re: PIC vs AVR
« Reply #3 on: August 11, 2008, 11:39:23 AM »
Financially, would it be worth it to get a PIC setup or just stick with AVR and forums?

Offline Webbot

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 2,165
  • Helpful? 111
    • Webbot stuff
Re: PIC vs AVR
« Reply #4 on: August 11, 2008, 12:07:24 PM »
I would suggest that there may be a greater knowledge bank within SoR on AVR devices.

Financially: don't PIC devices require you to make a substantial investment to buy their C compiler rather than the free AVR toolset?
Webbot Home: http://webbot.org.uk/
WebbotLib online docs: http://webbot.org.uk/WebbotLibDocs
If your in the neighbourhood: http://www.hovinghamspa.co.uk

Offline javafiendTopic starter

  • Robot Overlord
  • ****
  • Posts: 125
  • Helpful? 0
Re: PIC vs AVR
« Reply #5 on: August 11, 2008, 12:38:09 PM »
That's what I've heard.  I don't have that kind of cash laying around.

Free is good.  AVR is good.

Offline Admin

  • Administrator
  • Supreme Robot
  • *****
  • Posts: 11,703
  • Helpful? 173
    • Society of Robots
Re: PIC vs AVR
« Reply #6 on: August 11, 2008, 12:44:28 PM »
I made the $50 Robot AVR based because at the time AVR's were much cheaper.

But someone mentioned recently in the forum that the newer 18 series of PICs no longer require expensive external programmers, and now come with free programming software. Basically what AVR has had for years . . .

paulstreats

  • Guest
Re: PIC vs AVR
« Reply #7 on: August 11, 2008, 01:52:10 PM »
That was probably me  ;D

You can use the student version (also licensed for commercial use) of microchip C18 compiler. The only limitations are reduced code optimization (unlike previous free PIC compilers that only worked with a handful of devices and were limited in code size etc..)

 As for programming, you can buy cheap JDM programming cables like this for $11.95 http://www.sparkfun.com/commerce/product_info.php?products_id=9 which works in a very similar way to the atmega one in the $50 robot. If you are handy with electronics you can make your own from a schematic for under $1 (I did this in the end when my old and expensive PIC programmer got left behind and needed expensive firmware and hardware upgrades)

 To actually program with a cable like the one above you need something like IC-prog which is a freeware program.

 As well as the compiler you get to use the free MPlab IDE where you write your code. You can run software simulations of the code to make sure it works before transfering it to the pic. Also it lets you get full disassembly listings of your C code, monitors Device memory and code space usage etc...

I might do a small tutorial on using PIC18 devices soon.

Offline Iron Man

  • Full Member
  • ***
  • Posts: 74
  • Helpful? 0
Re: PIC vs AVR
« Reply #8 on: August 12, 2008, 02:11:03 PM »
paulstreats

if you want any help with that tutorial i'm willing to help.

I've just spent the entire summer writing firmware for pic18's
Also a GREAT place for pic18/pic24/pic32 info is microchip.com, they've got a great forum on there with insanely fast answer times.
another great resource is Chiefdelphi.com It's centered around the FIRST, but they all use pic's. And if you're looking for base code to expand from use Kevin Watson's code. It has many many things already taken to a high level of abstraction AND it's free! It's great code, you'll find all sorts of tidbits on there, from IR to Encoders to Cameras.

Kevin Watson's Website *he's a nasa dude, he's legit*
www.kevin.org/frc

*pic24 is the 16bit controller
*pic32 is the 32bit controller

Offline GHF

  • Jr. Member
  • **
  • Posts: 29
  • Helpful? 0
    • GeeksHaveFeelings
Re: PIC vs AVR
« Reply #9 on: August 12, 2008, 03:06:42 PM »
Hi-Tech has made their extremely optimizing C compiler for PIC10/12/16 available for free last month. That compiler is really amazing compared to CCS or any of the BASIC compilers.

I got started with a PICKit 2 programmer and free samples of PIC16s from Microchip. I'm still using the PICKit, but now I'm on their pretty new PIC18 lines with built in USB transceivers. I use the free C18 compiler. The most appealing part of the PIC setup is that once you pay for the programmer, everything you do is free, because you can get free samples of chips from Microchip.

I found that the AVR compiler didn't optimize code very well, but I guess that's true for most GCC toolsets. Doesn't matter, I guess, since AVRs tend to have much larger program spaces.

As for actual hardware differences, there isn't that much. AVRs have more program memory (and, since it's modified Harvard architecture, more RAM), and fewer choices in their lineup, but still enough to fill every niche. AVRs are 12 to 20MIPS, and operate 1MHz = 1MIPS. PICs are 20MHz for 16F and 40MHz to 48MHz for 18F. However, they operate 4MHz = 1MIPS, so that's actually 5MIPS, 10MIPS and 48MIPS.

I would say AVR is definitely better, but I don't really want to pay for it, so I'll stick to my PICs. However, there are plenty of reasons to use AVR over PIC. Lots of books, documentation, and code are written for very old PICs. PICs are used more extensively in industry than are AVRs, and vice versa in hobbyist fields. Since hobbyists do cooler stuff (in general :D), that's a good reason to switch. Kind of like the reason why you should use Python over other scripting languages: because more cool stuff is going on in that camp.

Offline Iron Man

  • Full Member
  • ***
  • Posts: 74
  • Helpful? 0
Re: PIC vs AVR
« Reply #10 on: August 12, 2008, 03:53:54 PM »
Quote
PICs are 20MHz for 16F and 40MHz to 48MHz for 18F. However, they operate 4MHz = 1MIPS, so that's actually 5MIPS, 10MIPS and 48MIPS.

i think you mean 12MIPS.

Why do you guys think AVR is better?
Just because more people use it? Why do you think more people use it?

Offline JesseWelling

  • Expert Roboticist
  • Supreme Robot
  • *****
  • Posts: 707
  • Helpful? 0
  • Only You Can Build A Robot!
Re: PIC vs AVR
« Reply #11 on: August 12, 2008, 08:54:58 PM »
AVRs were designed to run C code. PICs were most definitely not. But like it says PIC18s are a big step over the PIC17 I had (the Cerebellum back in the day, remember how many times I bricked that Admin? Gah  :P)

Offline GHF

  • Jr. Member
  • **
  • Posts: 29
  • Helpful? 0
    • GeeksHaveFeelings
Re: PIC vs AVR
« Reply #12 on: August 13, 2008, 08:28:31 AM »
Oops, you're right. 12 MIPS.

The PIC userbase is bigger, actually, but if you subscribe to PIClist, you'll find that most of these guys are pretty hardcore and they're using PICs in "applications" in their "jobs." The users of AVR are more likely to post their "projects" on their blogs.

Basically, what I'm trying to say is that you're going to find lots other hobbyists who use AVRs in robotics and homebrew electronics. The PIC community is also very knowledgeable and helpful, but sometimes they're more worried about power consumption or form factors or whatnot, because there are more professionals mixed in.

Of course, these are all generalizations. You'll find that you can do anything you like with either set of tools, and plenty of people that are doing what you're doing in either camp.

Offline TrickyNekro

  • Contest Winner
  • Supreme Robot
  • ****
  • Posts: 1,208
  • Helpful? 15
  • Hardware and Firmware Designer
    • The Hellinic Robots Portal
Re: PIC vs AVR
« Reply #13 on: August 13, 2008, 09:40:22 AM »
If pic userbase is bigger you can always convert PIC projects to AVR projects...
As said before the main concept is always the same...


If I was to use PIC or AVR... Although I haven't used PIC a lot, almost non, that would be a very tough choise...

Yes AVR are free software and all... but still something I don't like... Maybe it's the compiler... cause I can not generate the frequencies
I want precisly and I'm a little bit furstrated about this... Everything else is far above the middle...

PICs.... the not free compiles was such a great repulsion so far that I would even think about them...
But some of them, have peripherals that I have dreamed of... And I'm not talking about the can bus and such...
I have never used it anyway. Some USB PIC via a bootloader can be directly recognised and programmed via USB...

That's too much for me forget the cost and anything else...
I wait for the new ATXmega to come... until then I can not talk...

Generally without being using the PICs for complicated projects and having used AVRs for almost anything, I can not
judge 'em and say: hey yo AVR rulezzzz or PIC rulezzzzz.....

Regards, Lefteris
For whom the interrupts toll...

Offline Rebelgium

  • Supreme Robot
  • *****
  • Posts: 637
  • Helpful? 0
  • It's called the future ... We like it here
    • orgcrime.net
Re: PIC vs AVR
« Reply #14 on: August 14, 2008, 04:17:49 PM »
I like them both, but I use PICS.

Mainly because PIC has a wider userbase, thus more people to ask questions to etc.
btw, I have done a few projects with PICs now, and I have paid about 1€ or so... :p

that 1€ was for the components to build my programmer. Everything else (MPLAB, C18 compiler, PICS, ...) is free.
To relax after some hard work on robotics: A very fun free online text based MMORPG
orgcrime.net

Offline RobD

  • Full Member
  • ***
  • Posts: 64
  • Helpful? 0
Re: PIC vs AVR
« Reply #15 on: August 15, 2008, 10:59:46 AM »
I generally prefer the PIC along with the assembly language.  There are limited commands available but I have yet to find a project I haven't been able to implement using assembly (sometimes like with the older 16F series, etc.. an extra math-coprocessor chip is required).  I find it to be a rewarding challenge ;)

Porting projects over from other languages, etc... is another challenge altogether.  You have to match processor speeds then figure out what steps are happening when and in what order among other minutia.  The end result is that I have been forced to try and fully grasp what is happening within my code and learn each and every aspect of the microcontroller's capabilities. 

I also like having all available memory available to my application which is typically not the case when a bootloader is involved. 

Cost-wise, the initial expense was the programmer.  Now it's just the chips - and brain cells :)

With ICSP (In Circuit Serial Programming) you can update the software while the PIC is in place using four wires.  The MPLAB suite from Microchip is free and has a debugging routine built-in.  You can also run your code in the circuit itself during debugging, although I have "yet" to try this out.  -sounds interesting though. 

Good luck! 
   

Offline Iron Man

  • Full Member
  • ***
  • Posts: 74
  • Helpful? 0
Re: PIC vs AVR
« Reply #16 on: August 15, 2008, 11:06:13 AM »
The in-circuit debugger is nice. You should check out the Special Function Registers Watch window and the Watch window. They allow you to see what all of your registers and variables are when you stopped the debug.

No more diagnostic printf statements.

 


Get Your Ad Here

data_list