Pages

Wednesday, October 12, 2011

Chapter 8: The AVR I/O

What you have read in my blog so far were for preparing you to be able to program a Microcontroller. Now you can write some code in AVR Studio and program the AVR flash memory with the compiled hex file. Its time to go mainstream. From this chapter lets start building our dreams. You will see what a simple block of code can do. Its time to experience it. Its amazing, its fun and it will evaluate the creative part of your mind.

I will go with coding techniques and algorithms for various functions of a microcontroller. Most of them are interrelated. I will explore them in a certain sequence. This chapter deals with I/O; the most essential portion of an embedded system.


Concepts of I/O
I/O is the shorter version of the term Input/Output. In every programmable device, there is some sort of interface to communicate with the outside world.

Ports & Pins
The total number of pins varies from device to device. For example, ATmega8 has 28 pins, ATmega16 has 40 pins and the smallest one ATTiny15 has 8 pins only. We can't use all the pins for our I/O purposes. Some pins are reserved for some special jobs; for example VCC, GND etc. Different pins of a MCU perform different functions. For our I/O needs, some pins are available in a collective form called PORTS. A port means a collection of Pins. Generally, in an 8 bit MCU, each port consists of 8 pins.
Fig: Cable and Port Analogy

Here is an analogy for you between a cable consisting of several lines and a port that consists of several pins.

Wednesday, October 5, 2011

Chapter 7: Programming with the USB Programmer

We have used Pony Prog for programming using the Serial/Parallel ISP Cables. Pony Prog does not support any USB programmer. So, we need to look for alternate software. One of them is AVRDUDE. It is a command line based programmer. Writing command lines is annoying for most of us .There are Graphical User Interface (GUI) based programmers available. They are quite good too.

I will discuss about AVR8 Burn-O-Mat; so far the best one in my judgement. Before you use that, you should practice a few AVRDUDE commands which will give you some insight on accessing usbasp and the target devices. In fact, AVR8 Burn-O-Mat employs AVRDUDE for its programming tasks. Lets get started with AVRDUDE.

Monday, October 3, 2011

Chapter 6: Making your own USB Programmer

Fig: USB In System Programmer for AVR
Programming the microcontroller with parallel or serial port programmers seems to be a tedious task. Especially for those using laptops, there is no way out. These ports are extinct now a days. So, USB remains as the only option. I am going to demonstrate the process of building, configuring and installing a USB programmer. It is easy to build and the required components are widely available.

The Circuit
The original creation was by Thomas Fischl. To know more, you can visit his site.
I have done a few modifications of the original to make it simpler to implement.

Wednesday, April 27, 2011

Chapter 5: Programming the AVR


As we progress with our mission to deal with Microcontrollers, its time that we really start programming it. I have shown you how to construct an ISP Cable. Its time to test it. We will implement and test our system in a breadboard.

We will need a power supply for the digital circuits. We know a digital circuit runs from either 3.33V or 5V of supply. We will be commonly using 5V logic. So we need a 5V power supply capable of feeding all the devices we might run.