micorcontroller help

Translate This Thread From English to

Threaded View
hi all,
i am very new to robotics. i have done some reading into what
microcontrollers i might work with, and have narrowed it down to PICs
and Atmel ICs, any reason to go with Atmels over PICs? i am mostly into
automation, like controlling servos and motors (all DC).
also can someone point me in the direction of getting started tutorials
and/or guides?
i know my way around ANSI-C, took advance C for engineers at college.
thanks,
-zalnn


Re: micorcontroller help



free c compiler for all avr's
not just some like the pics free student c compiler for 18f's only


avr's  www.avrfreaks.net



Re: micorcontroller help


I use PICs quite quite bit, but honestly, the AVRs are probably a better
way to go. There are a wider variety of free tools available, and the
AVRs generally seem to offer a better mix of features. The main reason I
use PICS is that AVRs used to be subject to major supply problems -- I
don't know if this is still the case or not, however.

Re: micorcontroller help


I don't know much about AVR's, but PIC's are often the best/cheapest way
to go when you need real tight timings. Are AVR's RISC?

Re: micorcontroller help


AVRs tend to be described as RISC, but I believe the instruction set is
substantially larger (over 100) than the PICs 30-odd commands --
however, most execute in a single clock cycle with some notable exceptions.

Like the PIC, the AVRs (or at least the ones I'm familiar with) are
Harvard architecture.

Re: micorcontroller help


Ok, thanks. Still, can you really get down to a 100 ns precision with
AVR's in real-world applications, like you can with the PIC 18Fxxxx
series? (Not to talk about the ds30 family, which can do ever more
wonders ;-) )


To me, the Harvard architecture is a real plus for most embedded
application... but not a lot of people like it. I do.

All that said, PICs are often unfairly misjudged. Every time I used
them in some project, the project was released the quickest, smoothly
and without any furter problems. Every time I had to use 8051-based
microcontrollers, on the other hand, that was nothing but pain along
the way. And yet, 8051s are still very, very popular. Not fair. ;-)

As for development tools: Microchips tools are, for the most part, free,
and pretty good too.
The C compilers aren't free, but they are largely usable and they cost
less than $400 for a single license - not what I call a big investment.

Re: micorcontroller help

Guillaume <"grsNOSPAM at NOTTHATmail dot com"> writes:

For me, it's the endless reams of PDF's on the Microchip website.

Not just errata, but *regularly updated* errata with silicon versions.

Migration guides from any PIC to any other PIC, it seems like.

Oh, and my favourite comment about PICs:

"If you think it's the PIC that's wrong, you haven't looked at the rest
of the circuit".

cheers, Rich.


--
rich walker         |  Shadow Robot Company | rw@shadow.org.uk
technical director     251 Liverpool Road   |
need a Hand?           London  N1 1LX       | +UK 20 7700 2487
www.shadow.org.uk/products/newhand.shtml

Re: micorcontroller help



Precision of what?  The max clock on most AVRs is 16 MHz so that's the
max clock speed of their on-board timers which give you one clock
every 62.5 ns for things like pulse-width measurement, pulse
generation, etc.  That's also how fast many of the instructions
execution - 62.5 ns, so I guess the answer to your question is "yes",
unless you mean something else.

I'm not an expert on PICs, but my understanding is that they execute
one instruction rougly every 4 clock cycles.  For an AVR, this is one
instruction roughly every clock cycle, so clock for clock, the AVR is
roughly 4x faster.  So a 40 MHz PIC is roughly equivalent to a 10 MHz
AVR.

But one of the bigger plusses is that the AVR instruction set was
designed with high level compilers in mind.  Atmel actually teamed
with with IAR when designing the AVR instruction set so it is designed
to include features that high level language compilers can take good
advantage of with regard to code generation in terms of code density
and speed.  AVRs have very good code density and with 32 general
purpose registers and the full gambit of addressing modes makes for
efficient code.  Architectures with only a few registers or are
accumulator based spend a lot of time shuffling data back and forth
between RAM and the few working registers.


The open source GNU GCC is an excellent C compiler and freely
available for the AVR target.  There are a number of excellent
commercial C compilers available also, of course, IAR probably being
the best, but it is a bit expensive for your average Joe.

-Brian
--
Brian Dean
ATmega128 based MAVRIC controllers
http://www.bdmicro.com/

Re: micorcontroller help



Not really and does it really matter ?

Both are cheap and pretty easy to use.

Avrs are similar to pics , bit faster.
A good over view of AVR
http://en.wikibooks.org/wiki/Atmel_AVR

For me the main advantage of the avrs are:

IDE / simulator from atmel is better IMO - windows only though

free c compiler (avrgcc / win avr)  available on all platforms - windows ,
linux , OS X , freebsd

PICS  16f are good for beginners who want to learn assembly
as there are only 35 instructions  where as most avrs have 115 asm
instructions.

18f  have around 88 instructions.

Both  have lots of code on the web.

If you want to use basic there is the demo version of bascom avr available
for free from mcs
http://www.mcselec.com/bascom-avr.htm
http://www.mcselec.com/download_avr.htm

Some quite impressive avr projects here
http://instruct1.cit.cornell.edu/courses/ee476/FinalProjects/
http://instruct1.cit.cornell.edu/courses/ee476/video/


The atmel stk500  is a pretty good starter board - acts as programmer and
board
http://www.atmel.com/dyn/products/tools_card.asp?tool_id '35

http://www.atmel.com/dyn/products/tools_card.asp?tool_id '25 avrstudio

http://www.bdmicro.com/   makes some nice boards.
Brian also has some code examples in c and basic.

A low cost starter kit is an avr butterfly
http://www.atmel.com/dyn/products/tools_card.asp?tool_id146
+
base board from

www.futurlec.com   sell some quite cheap avr , pic , 8051 boards
(pre-assembled not kits)
http://www.futurlec.com/DevelopmentBoards.shtml
http://www.futurlec.com/TrainingBoards.shtml
http://www.futurlec.com/BasicControllers.shtml


Alex



Re: micorcontroller help


But with the PICs you have to deal with that annoying bank switching which
isn't so beginner-friendly.

Mitch



Re: micorcontroller help



Its not to bad.
Find it causes less hassles for beginners than look up tables and page
boundaries.

Had lots of questions on look up tables (16f877) this semester (just
finished),
more than a few people with problem of falling off the end of the table or
using the short table method and hitting the page boundaries.

Trick is to have any bank switching in your setup routine and try and keep
most or all of the main part of the program in bank zero.

Can't avoid it all the time.

Microchip documentation does tend to be better.
No datasheets that stay marked as preliminary for the lifetime of the chip.

Microchip for me has the best docs of any of the companies thast produce
micros I use.

microchip <- atmel <-analog  /TI <- zilog
philips and winbond equal worst  I've come across.

Alex



Re: micorcontroller help


Like you, I am new to both, and exploring PICs now and plan to with AVRs
too.

I am working on my first robot project using PICs and the CCS C compiler.
For PICs go to this site for programmer/test board, and free evaluation
version of C compiler & IDE ( althogh CCS C compiler has better support
for PWM for
DC motors control ):

www.mikroelektronika.co.yu

Also go to their "Books" section for a very good online tutorial on PIC
basics
( assembler ). One of my lecturers has included this tutorial in one of
his PIC courses.

I also just got Myke Predko's "Programming and Customizing PICmicro
Microcontrollers"- which is apparently a major reference.
I recommend the CCS C compiler for 16F series ( USD $125 )
http://www.ccsinfo.com/picc.shtml .

There is also a textbook using CCS C called
"Embedded C Programming and the Microchip PIC".

Finally, I have a brief guide on my website:

http://www.users.tpg.com.au/daleste/Microcontrollers/PICmicro/pic.htm

-------------------------------------------------------------------------------------------------------------

For AVRs, there is a book I bought called C"C Programming for
Microcontrollers Featuring
Atmel's AVR Butterfly and the WinAVR Compiler" ( www.smileymicros.com )
- for USD$ 20 you can buy an awesome
  Butterfly evaluation board from digikey.com - nothing comes near it for
this price - nothing!


Hope this helps

: -]

Cheers

Dale

Re: micorcontroller help

Two main advantages to each micro (IMHO) if you are comfortable with C:

PIC's - Myke Predko's books (I like "Programming Robot Controllers"),
and free no hassle samples from Microchip.

AVR's - Easy in-circuit programming, and AVR Freaks.

As far as disadvantages, PIC's need a programmer (Myke's book shows how
to build one for under $20US) and getting AVR samples from Atmel is akin
to getting a green card (slow and difficult).

I prefer the AVR but for a reason that won't matter to you; I hate C so
I need a good, cheep BASIC compiler.  Bascom for the AVR is free (4K
limit, $79 full version) while PICBasic is $100US ($250 for the pro
version).

My suggestion: learn to use both.  Start with Myke's book and the free
PIC's.  After awhile, try the AVR.  Since you can get PIC's and AVR's to
communicate, there isn't a problem using both in one robot. Knowing the
strengths and weaknesses of both will allow you fit the right part to
each application.

Catman

Dale Stewart wrote:

-------------------------------------------------------------------------------------------------------------


Re: micorcontroller help



I bought Myke's book "Programming Robot Controllers", for PIC robotics,
but from my experience wouldn't recommend it for a BEGINNER
( however, it IS an excellent book for INTERMEDIATE to ADVANCED PIC
roboteers, maybe the best available ).

Another book I forgot to mention is "Easy Microcontol'n"
( assembly-language ) from www.sq-1.com
although I think I covered this on my website at :

http://www.users.tpg.com.au/daleste/index.htm

although it is based on assembly language, it is a very good
introduction to the inner workings of PICs.

Hope this helps.

:-]

Cheers

Dale

Site Timeline