AVR Tutorial 2: AVR Studio Quick Start Guide

In this tutorial, I am going to show how to use AVR Studio IDE and WinAVR in developing software for AVR microcontrollers. In this tutorial, my target AVR microcontroller is ATmega8 and I will be using AVR Studio version 4.18.700. I am assuming that you have downloaded and installed WinAVR and AVR Studio. If you have not installed both, please do so. Installation must be straight forward and please use the default installation directories to avoid confusions.

If you have already installed AVR Studio and WinAVR, then you are ready to get started with the software development.

1. Run AVR Studio by double-clicking the AVR Studio icon on your desktop or by going to Start->Programs->Atmel AVR Tools->AVR Studio 4.

[Read more...]

Pages: 1 2 3

AVR Tutorial 1: Introduction

Good day! Today, I am starting a new series of microcontroller programming tutorials. This series of tutorials is about AVR microcontroller programming using C language.

Before we get started, let me express my assumptions while writing this series of tutorials. In this series of tutorials, I am assuming that the reader is already familiar with C programming language. I am assuming that the reader knows how to read a schematic diagram, construct a circuit based from a given schematic diagram, and analyze electronic circuits. I am also assuming that the reader is able to use Windows applications. [Read more...]

Pages: 1 2 3

8051 Tutorial 6: 8051 Interrupts Programming in C

What is an interrupt?

An interrupt is an asynchronous signal that needs attention. An interrupt stops the CPU of a microcontroller, leaving the tasks that it is currently doing, to give attention to the interrupt signal. Once the attention has been given to the interrupt signal, the CPU goes back to its unaccomplished task before the interrupt has occured and continues the task.

The Interrupts of AT89C2051

The interrupts of AT89C2051 is compatible with the interrupts of the original 8051 microcontroller. It has 6 interrupts sources ( 5 interrupts + RESET). The interrupt sources of AT89C2051 are the following:

Interrupt Source Priority Number
1 RESET RST N/A
2 External Interrupt 0 IE0 0
3 Timer 0 Interrupt TF0 1
4 External Interrupt 1 IE1 2
5 Timer 1 Interrupt TF1 3
6 UART Interrupt RI or TI 4

Please note that in this tutorial, we will not consider the interrupt from RESET.

The table above shows the interrupt sources of AT89C2051 and their respective interrupt priority number. Knowing the priority number is important specially if two different interrupt sources occur at the same time. [Read more...]

Pages: 1 2 3 4

8051 Tutorial 5: 8051 UART Programming in C

What is UART?

UART stands for Universal Asynchronous Receiver/Transmitter. As its name implies, it is universal. It can be used to establish a communication between a microcontroller and another device – microcontroller, USB controller, Bluetooth modules, GSM modules, GPS modules, personal computers, etc.

I am not going to discuss the UART protocol here. If UART is still unknown to you, you may read this article from wikipedia first.

 

What is RS-232?

RS-232 is a standard for serial transmission of data between a DTE (Data Terminal Equipment) and a DCE (Data Circuit-terminating Equipment). It is commonly found in desktop computers where it is commonly referred as COM port. You can read this wikipedia article for more info about the RS-232 standard.

 

AT89C2051 UART

The AT89C2051 has one UART port. Its TXD (Transmit) pin is the same as its P3.1 pin. Its RXD (Receive) pin is the same as its P3.0 pin.

[Read more...]

Pages: 1 2 3 4

8051 Tutorial 4: 8051 Timer/Counter Programming in C

This tutorial is about using the internal timers/counters of 8051. This will tackle the registers associated with the internal timers/counters of 8051 and this will also enumerate the steps on using the timers/counters of an 8051 microcontroller.

The Timers/Counters of AT89C2051

The AT89C2051 has two 16-bit Timer/Counters: Timer0 and Timer1. This means that it can time/count from 0 to 65535 (2^16-1). The timers can be used to generate accurate delays and the counters can be used to count events. An event can be anything. It can be a pulse, a push, a pull, or any stimulus. [Read more...]

Pages: 1 2 3