Category Archives: AVR Tutorials

Interfacing Seven Segment Displays

Seven segment displays are very common for electronic product to display numerical output. Many common devices like calculators, watches, electronic weighing scales,ovens etc use them. You must have also seen lifts display the current floor numbers in seven segment displays. So in this article I will show you how to use 7-Segment displays in your own projects. Fundamentals A seven-segment display is so named because it is divided into seven different segments that can be switched on or off. The different combination of these segments switched on produces different English numbers. The display also has a decimal point.   Fig: Seven Segment Display Fig: ’4′   The figure shows a seven segment display and the names of the various segments. For example if you want to display number 4 then segments that will be ‘on’ are {f,g,b,c} while rest are ‘off’.Basically the seven segments are just LEDs. The one common end of all the leds are connected while the rest are available. Depending on whether anode or cathode of all the leds are common they are of two types. 1) Common anode 2)Common cathode Fig: Common Cathode Type Fig: Common Anode Type PIN Configuration Now you know the basic of these displays, to use them you should know the pin configuration of the commercially available displays. As you must have […]

Input Output Ports of AVR

Digital IO is the most fundamental mode of connecting a MCU to external world. The interface is done using what is called a PORT. A port is the point where internal data from MCU chip comes out or external data goes in. They are present is form of PINs of the IC. Most of the PINs are dedicated to this function and other pins are used for power supply, clock source etc as you have seen in Part III of my tutorials. Ports are named PORTA, PORTB, PORTC, PORTD etc. The pin configuration of ATmege8 mcu is shown below Fig – Mege8 pin configuration   As you can see the pins are labeled PC6,D0,PD1…etc . A port say PORTD is a 8bit register you can set it to any value likePORTD=0xFF; In C language prefix 0x signifies a hexadecimal number here 0xFF means decimal 255 or binary 11111111 which means all the bits in the register is high. A high value on the output port gives +5V and 0 gives ground. You can set the value of PORTD to any required value. This is the basic of digital interface. You can connect LEDs, and switch them on/off from your program. You can connect speaker and produce desired frequency by quickly switching the PORT pin on/off to get sound. But these […]

Part IV – The “Hello World” project

Now you have the basic hardware tools, its time to setup the software environment.The main software you will need are: AVR Studio – A GUI IDE for AVR(www.atmel.com, http://www.atmel.com/dyn/resources/prod_documents/AVRStudio4.13SP2.exe) WinAVR – a free C compiler for AVRs (http://winavr.sourceforge.net/download.html) PonyProg – Serial Device Programmer (www.lancos.com) After downloading them install them in your computer. It is better to install WinAVR in root of a drive like c:\winavr or d:\winavr. Also please install WinAVR first then AVR Studio, this will let AVR Studio detect the compiler. Now you are ready to write you first microcontroller program !!! In this tutorial, you will learn the basic steps required for any microcontrollers based project. We will write a basic “hello world” project, which is a simple LED blinker in MCU empire to demonstrate these basic steps. Step I Entering and compiling code. Start “AVR Studio” from Start Menu->All programs->Atmel AVR Tools-> AVR Studio 4 You will be presented with a Project wizard as shown below. Fig – AVR Studio Project Wizard Fig – Project Details   Select AVR GCC in Project type then enter a suitable project name say “hello” and select a location in you hard disk. Then click next. Make sure that “Create initial file” and “Create folder” option is checked. Fig – Device Selection   In this dialog box select AVR Simulator […]

Part III – Making Programmer and Target.

Now you know what tools are required for MCU based development. And you are familiar with their uses. Now time to start some real development.To cover these parts you must have some basic knowledge and tools of electroniccircuit fabrication. So now, let us start with the most important tool the programmer. Making a programmer. There are many different types of programmers available on the net. The basic difference is their interface with the PC. Basically, there are three types of programmers. Serial Port based Parallel Port based USB Port based. Of these serial port based and parallel port based programmers are easy to make in minimal cost. However, the parallel port is little bulky as compared to serial port, I prefer serial one. One of the best programmers I have come across is PonyProg(http://www.lancos.com) Serial Device Programmer it is a package of simple and low cost programmer with easy to use GUI software. I have been using it from long time. So here I will teach you to make PonyProg device programmer.   Note As the serials and parallel ports are very old technologies they are fast disappearing from PCs. Most laptops are not having them and even desktops are dropping them. Therefore, its no surprise that your PC does not has serial ports. In this case, you have to […]