100 likes | 262 Views
Atmel AVR. Jared Bevis January 14, 2008. The Power of Your Chips. The main power of your chips lies in the programming language/compiler available to you. C is very powerful for both high and low level designs.
E N D
Atmel AVR Jared Bevis January 14, 2008
The Power of Your Chips • The main power of your chips lies in the programming language/compiler available to you. • C is very powerful for both high and low level designs. • BASIC is very easy to learn for beginners, however you are at the mercy of the compiler and built in functions of the language.
BASIC • Has a large variety of functions built in for the PIC including: • Digital to Analog conversion • Analog to Digital conversion • Software UARTS • LCD Support • Many others • Has very big limitations: • No floating point number support. • Very hard to change built in functions.
C • Does not have many “built in functions” • This is easily overcome as you build your own code libraries. • Common libraries will be provided in demos • LCD Code written by me • ADC Code written by me • Very flexible • Functions can quickly be written or modified for project specific purposes. • Supports advanced arithmetic • Floating numbers • Trig functions • Array support
AVR Features • AVR series come in both 32 and 8 bit architectures. • Shares many features with the PIC such as ADCs, UARTs, SPI, I2C, pin pull ups, interrupt on pin changes, etc. • Additional feature not present in PICs is sixteen bit PWM channels (generally three per 16 bit timer). • VERY useful for servo motor applications • AVR chips offer single cycle instructions; the PICs require four clock cycles for each instruction.
Gotcha’s for Each Chip • The PIC has many auxiliary functions of pins turned on by default such as comparators or PWM channels which must be manually turned off for certain compilers to enable normal I/O functions. • The Atmel AVR has fuse settings which must be written into the device. If settings are incorrect for your application, you may render the chip useless.
AVR Software • The AVR software is written by the manufacturer Atmel. AVR Studio is available for free download. • Natively supports assembly programming. • Companion software to AVR Studio is WinAVR. • Provides a C compiler for AVR Studio. • AVR Studio projects are easily written in C and integrate well with WinAVR for compilation.
Both pieces of software are provided free without licensing hassles or royalty fees. • Download AVR Studio from http://www.atmel.com/dyn/products/tools_card.asp?tool_id=2725 • Download WinAVR fromhttp://sourceforge.net/project/showfiles.php?group_id=68108&package_id=66543 • Be sure to install AVR Studio before installing WinAVR.
Programming Hardware • Hardware is relatively cheap ~$35-$40 • With school discount Atmel is about $17 • Highly recommend buying your own whether you choose to use PIC or Atmel (programmers are NOT allowed to be taken outside of lab): • PIC programmer is Pickit2 • AVR programmer is AVRISP mkII • Both these programmers will program your chips in circuit using about five pins. See documentation for connection info.