What is Microcontroller Programmer

March 6, 2010 at 8:49 am | Posted in AVR Tools, Microcontrollers | Leave a comment
Tags: , ,

 

In the days of microprocessors and earlier microcontrollers EPROMS were being used to store Monitor Routines or Firmware.

To develop and store/erase the Firmware on these EPROM chips one used to need EPROM PROGRAMMERS and ULTRAVIOLATE EPROM ERASER.

But these days most of the microcontrollers have built in FLASH memory on the chip. The Firmware usually developed on a PC/LAPTOP in C/C++ . This Firmaware Program is then cross compiled for the particular microcontroller. The compiled binary program is then downloaded on the target microcontroller using special hardware called MICROCONTROLLER PROGRAMMER. This can be stand alone or for IN SYSTEM PROGRAMMING(ISP).

Types of Microcontroller Programmers

The microcontroller programmers are basically of three types

1. Serial Port(COM1/COM2) based

2. Parallel/Printer Port(LPT) based

3. USB Port based

Installing AVR Development Tools On Windows

February 22, 2010 at 3:26 am | Posted in AVR Tools, Microcontrollers | Leave a comment
Tags: , , ,

Installing development environment on windows is pretty easy. You will need two software packages for this purpose

  1. WinAVR which is a open source  AVR-GCC compiler for AVR microcontroller for windows platform.
  2. AVRStudio which is a free and powerful Integrated Development Environment (IDE) from ATMEL which has a built in assembler, debugger and it can integrate AVR-GCC compiler under this IDE.

To install WinAVR first download the latest package of WINAVR here and install it on your computer. Next download latest version of AVRStudio from Atmel’s download  page. After downloading AVRStudio install it on your computer.

Now you are set to go.  In next blogpost I’ll show you how to get started with WinAVR and AVRStudio.

What is Arduino?

February 13, 2010 at 4:18 am | Posted in Arduino, AVR Tools, Microcontrollers | 1 Comment
Tags: , ,

Many people ask me what is Arduino. They think that it is some hi-fi gadget for the techies. Well it is exactly opposite. It is a tool designed for noobies who want to learn or are interested in programming microcontrollers. It is actually a computer which can be programmed an used to sense and control parameters in the physical world, task which a common desktop cannot do easily.

Arduino board consist of a Atmel microcontroller, typically ATMega168 which normally has preloaded boot loader. Because of this boot loader, Arduino can be programmed without a special program burning tool.

Software part of Arduino consists of Integrated Development Environment (IDE) designed and developed in wiring/processing. With this IDE even noobie can write a program for avr microcontroller and program the microcontroller chip by uploading the program through IDE by  pressing upload button.

With Arduino IDE you don’t need to have precise and detailed knowledge of microcontroller’s internal architectures.

Using USBASP Programmer From Arduino IDE

February 4, 2010 at 3:07 am | Posted in Arduino, Microcontrollers | Leave a comment
Tags: ,

If you are using usbasp based AVR USB programmer you will dejected  to find that Arduino’s default IDE settings do not have an option provided for using USBASP when loading the bootloader on your Arduino board.

To include your USBASP based AVR USB Programmer as an option in Arduino IDE just coppy the following instruction to programmers.txt file in \hardware\arduino folder in Arduino IDE’s installation folder.

usbasp.name=USBasp
usbasp.communication=usb
usbasp.protocol=usbasp

 

Now you’ll be able to use use your usbasp based AVR USB Programmer as shown  the following screenshot, without a problem.

avr_usb_programmer06

Installing AVRDUDE on Ubuntu Linux

February 1, 2010 at 4:14 am | Posted in AVR Tools, Microcontrollers | Leave a comment
Tags: ,

In the last blog post we saw how to install free C compiler for AVR on Ubuntu Linux. Now with this compiler you will be able to write and compile c program for avr micro on Ubuntu. After compiling the c program you will be able to generate .hex format file for downloading on  your target avr microcontroller.

To download the .hex file on the target microcontroller you need a programmer and programmer software. Here we’ll assume that you are already having a programmer (which may be a serial or parallel or USB port based programmer) therefore in this blog post we will describe how to install programmer software. Programmer software we’ll be installing is called avrdude. First download avrdude source file from avrdude website. To compile avrdude source files you will need few tools like flex, bison and byacc. You can install these by opening the terminal in Ubuntu Linux and typing

sudo apt-get install flex bison byacc

If you are using usb based programmer you will have to download libusb source, compile and install it before you configure and compile avrdude source.

Now untar the avrusb source downloaded by giving command

tar –xyzf avrdude-xxxxxx.tar.gz

then change directory to avrdude’s source directory by typing

cd avrdude-xxxxxx

now enter

./configure; make ; sudo make install

commands in the terminal. This will install avrdude programmer software on your Ubuntu Linux.

Installing AVR Development Tools on Ubuntu Linux

January 30, 2010 at 5:20 am | Posted in AVR Tools, Microcontrollers | Leave a comment
Tags: ,

Before we can write a program and download it to the avr microcontroller we must have proper development tools on the PC. In this blog post I’ll show you how to install C compiler for AVR microcontrollers on Ubuntu. Log into your Ubuntu  desktop, connect to the internet, open the terminal and then type

sudo apt-get install gcc-avr

and press enter

after gcc-avr is installed type

sudo apt-get install avr-libc

and press enter

finally type

sudo apt-get install gdb-avr

and press enter.

The above mentioned commands will install C compiler for AVR, libraries for writing AVR programs and the debugger on your Ubuntu Linux.

Input Output Ports

January 26, 2010 at 7:51 am | Posted in Microcontrollers | Leave a comment
Tags:

Input output ports are the basic interfaces to the microcontroller. It is with these ports uC communicates with the outside world. These ports are also known as IO ports. IO port usually consists of 8 digital data lines. Each one of these 8  data line can be individually programmed to be either as input or output.

ATMega16 consists of 4 IO ports. These are knows as PORT A, PORT B, PORT C and PORT D. Direction of the port (i.e. whether the port is input or output) is selected by writing either 1 or 0 to the corresponding bit in the register called Data Direction Register or simply DDR.

In ATMega16 there are 4 DDRS viz. DDRA, DDRB, DDRC and DDRD. If a bit in DDR is 1, corresponding   IO port pin gets programmed as output port and if a bit in DDR is 0 the corresponding IO port becomes an input. Writing all 1s to DDR makes the corresponding port an output port and writing all 0s to the DDR makes corresponding port as input Port.

In the next blogpost I will show you how to write and read data from IO ports using a C program.

A look at ATMega16 microcontroller

January 22, 2010 at 10:27 am | Posted in Microcontrollers | Leave a comment
Tags: ,

In this blog post we’ll take a look at Atmel’s ATMega16 Microcontroller.  I have chosen ATMega16 because the knowledge we get by studying and using ATMega16 can be applied to any other microcontroller device manufactured by Atmel.  Also the learning curve for becoming familiar with ATMega16 is quite gentle.

Architecture of ATMega16 is register based i.e. the registers which are collocated with CPU are used to store both the operands. In other words before an operation is performed, all the data required for the operation is loaded in the CPU.  After the operation is perfomed, the result is also stored in the register. Because the CPU interacts with the registers, data access is faster than the slower memory access.

The instruction set of ATMega16 consists of just few instructions (131 to be precise) which are required for basic operations. More complex instructions for the microcontroller are built from the these basic operations. This result in good efficient working of the micro controller. This type of  microcontroller with a instruction set consisting of  just few basic instructions is called Reduced Instruction Set Computer(RISC).

Instructions Set of ATMega16 consists of 131 RISC type instructions. Most of which can be executed in a single clock cycle. Therefore ATMega16 operating at 16 Mhz can execute 16 Million instructions per second. Wow!

The CPU of ATMega16 is designed using Harvard Architecture scheme. Hence the program memory is kept separate from the data memory.

——to be continued

Which Microcontrollers to Use?

January 20, 2010 at 3:48 am | Posted in Microcontrollers | Leave a comment

There are many companies which manufacture microcontrollers. But we will be considering only Microchip’s PIC and Atmel’s AVR microcontrollers.

Both PIC and AVR are easy to use and are easily available. The software development tools like compilers and emulater are available for these computers. But the PIC microcontroller is bit costly when compared to PIC. The development tools for PIC are also available at higher prices. So for for the beginners I suggest going in for Atmels AVR microcontrollers.

The development tools for AVR are available at much lower price and some of the development tools are available free of cost e.g. WIN-AVR is a  C compiler is available free of cost.

For most of the example/demo programs on this blog we’ll be using WIN-AVR and CodeVision C compilers. CodeVision’s C compiler (evaluation version with limitation of 3KB program) is available for download at http://www.hpinfotech.ro/html/download.htm

In the next blog post we will study the architecture of commonly used AVR microcontroller.

What is a microcontroller?

January 19, 2010 at 3:14 am | Posted in Microcontrollers | Leave a comment
Tags: ,

Before we proceed further  let us first find out what is a microcontroller and what it does.

Well, microcontroller is a computer on a single chip consisting of central processing unit or the CPU, memory, input/output ports,clock etc. Nowadays programs are stored in a chip on built in flash Read Only Memory(ROM). Small amount of RAM is also included in a microcontroller chip.

Unlike the multitasking, multiuser PCs,  microcontrollers are designed for small and dedicated applications used in control and instrumentation systems.

The application programs for the microntrollers are usually developed on PC in higher level languages like C and basic. However, sometimes one may use assembly language for the application programs. These application programs are then cross compiled with a suitable compiler. The compiled programs are then downloaded in microcontroller’s program memory using a suitable programmer.

In the coming blog posts we will study a microcontroller which is widely used.

Next Page »

Blog at WordPress.com.
Entries and comments feeds.

Create your own website, free on WordPress.com.Create your own website.
Start free