AVR microcontrollers are all In System Programmable (ISP) so it doesn’t make sense to use a socket programmer for them – AVR ISP is the way to go. But what features should you look for when you are choosing an AVR programmer?
AVRStudio is the development software for AVR microcontrollers supplied by Atmel to allow users to easily develop code for their devices. It includes project management, code editors, assembler and C compilers, simulator and programmer and emulator support. It has been developed over the years and has reached AtmelStudio v7.2 but older versions are available, so which version is the best for you?
An AVR microcontroller is a type of device manufactured by Atmel, which has particular benefits over other common chips, but first what is a microcontroller?
The easiest way of thinking about it is to compare a microcontroller with your PC, which has a motherboard in it. On that motherboard is a microprocessor (Intel, AMD chips) that provides the intelligence, RAM and EEPROM memories and interfaces to rest of system, like serial ports (mostly USB ports now), disk drives and display interfaces.
A microcontroller has all or most of these features built-in to a single chip, so it doesn’t need a motherboard and many components, LEDs for example, can be connected directly to the AVR. If you tried this with a microprocessor, bang!
We have been asked about how you can program an application code file and a separate bootloader into an AVR microcontroller using a Kanda programmer. It isn’t possible to program two separate files but it is simple enough to combine them into one file.
AVR Dragon is a low cost In System Programmer (ISP) and also an In Circuit Emulator (ICE) in one package. It operates from Atmel AVR Studio development environment and is great for code development.
What can it do?
One feature of AVR devices that can baffle new users is the default clock setting on new AVR microcontrollers. They are set to run from their internal RC oscillator, usually 1 MHz, which throws out the timing on code samples, such as UART.
If the code is configured for an 8MHz clock and there is a 8MHz clock on the target board, you expect it to work but instead you get nothing or garbled characters. This is due to the default Internal RC. How do you change it?
The AVR microcontroller is excellent with C code because it was designed with C in mind. Atmel have also made it easy to use C in AVR Studio, as WinAVR compiler can run from within AVRStudio just like the assembler.
Only a few years ago, using C compilers involved complicated commandline instructions and make files but WinAVR more or less takes care of this for you. WinAVR is based on the free GNU-GCC compiler but is much friendlier, especially for beginners.
The question we are often asked is should I start with C or assembly language to program my AVR microcontroller? Well, there are pros and cons to both approaches.
C has many advantages, including much faster code writing and increased portability. It is also much easier to understand and modify the code later. By using library files, code can be reused easily or pre-written functions can just be added by including a library.
Continue reading “AVR Microcontroller Coding” »
AVR microcontrollers are available from Atmel directly, from any of their distributors or here on the Kanda site. The range covers everything from 1KB 8-pin devices to 100-pin 256KB microcontrollers. Available package types include DIP, SOIC, QFN and TQFP. They feature all the usual peripherals including UART, SPI and Two Wire Interfaces, plus ADC, analog comparators and PWM for analog work and some have more advanced features like CAN and USB.
Continue reading “AVR Microcontrollers” »