Monday 30 December 2013

Real Time Clock using AVR

Real Time Clock using AVR



OBJECTIVE : To build a efficient real time clock for daily usage using AVR

COMPONENTS 

1.ATMega16
2.32,768 KHz crystal
3.LCD display
4.RS232 port

DESCRIPTION :

*The ATMega16 chip in the M16 has a real-time counter that operates asynchronously when a 32,768hz watch crystal is connected to it, providing a real-time clock

*Bascom has built-in support for the RTC, making it very easy to use time functions

*The watch crystal needs to connect to pins TOSC1(pin 28) and TOSC2(pin 29). The time and date can be set via the PC serial port connection

BLOCK DIAGRAM OFBLOCK DIAGRAM OF Real Time Clock using AVR


Tuesday 24 December 2013

Running LED or LED chaser Using AVR

Running LED or LED chaser Using AVR


OBJECTIVE :

The main objective of this project is build a Running LED or LED chaser Using AVR

COMPONENTS 


1.ATTiny2313 micrcontroller

2.CRISTAL 10MHz

3.CAPACITOR 22pf X 2

4.POWER SUPPLY +5V

5.RESISTOR 1K X 16

6.LED (15)


DESCRIPTION :


*This running LED or LED chaser is a good project for beginners in the micro-controller technology

*It is easy to build, and the assembler program code can be easily adapted

*This running LED light has 15 red 3mm LED's

*The 15 outputs of ports B and D are used to drive the leds

*The LED's light up in a pattern that can be made in the program code

*The LEDs run back and forth

*With a push button you can select another pattern at which the LEDs runs

*There are three running LED patterns which you can run: with one led, three leds and five leds.


HARDWARE DESCRIPTION :



*The project uses the ATTiny2313 micrcontroller but the ATTiny2313 can also be used

*The AVR port can draw 20mA current so you only have to place a resitor at the port of the AVR to limit the current to 20mA.

* The LEDs are connected to ground so when the output of the port is high the LED will go on

*The circuit uses a ceramic resonator of 10Mhz as oscillator

* When you use ATTiny2313 you can discard the resonator because they have an on chip clock source
SOFTWARE DESCRIPTION :

*The program code is written in assembler
*You can use AVR Studio to write the software



BLOCK DIAGRAM OF LED CHASER


Sunday 22 December 2013

LCD BASED THERMOMETER USING AVR

LCD BASED THERMOMETER USING AVR


OBJECTIVE : The main objective of this project is build a LCD based thermometer

COMPONENTS

1.ATMEGA 8 (DIL285)
2.TEMPERATURE SENSOR LM35
3.LCD 20*4
4.CRISTAL 10MHz
5.CAPACITOR 22pf X 2
6.POTENTIOMETER 10K
7.POWER SUPPLY +5V

DESCRIPTION :

*The LM35 is a precision centigrade temperature sensor
*Which has an analog output voltage
* It has a range of -55ºC to +150ºC and a accuracy of ±0.5ºC
*The output voltage is 10mV/ºC
*The output voltage is converted by the AD convertor of the AVR
* The temperature is displayed on an LCD module
* the thermometer has a range of 0ºC to 40ºC
*If you want to have a readout in Fahrenheit you can use the LM34

HARDWARE DESCRIPTION :

*The circuit the LM35 is connected to the ADC port of the AVR
*The ATMega8 uses a crystal as an oscillator for the clock pulses
* At PORT-D of the ATM8 an 20x4 LCD display is hooked to display the temperature in a    discrete value and in a analog bar

SOFTWARE DESCRIPTION :

*The software for this project is written in BASCOM AVR

BLOCK DIAGRAM OF LCD THERMOMETER



Program to make a bidirectional visitor counter using IR sensor

// Program to make a bidirectional visitor counter using IR sensor

#include <reg51.h>
#define msec 1
unsigned int num=0;
sbit dig_ctrl_4=P1^3;  //declare the control pins of seven segments
sbit dig_ctrl_3=P1^2;
sbit dig_ctrl_2=P1^1;
sbit dig_ctrl_1=P1^0;
unsigned int digi_val[10]={0x40,0xF9,0x24,0x30,0x19,0x12,0x02,0xF8,0x00,0x10};
unsigned int dig_1,dig_2,dig_3,dig_4,test=0;
unsigned char dig_disp=0;
sbit up=P3^5;  //up pin to make counter count up
sbit down=P3^6;  //down pin to make counter count down

void init()  // to initialize the output pins and Timer0
{
up=down=1;
dig_ctrl_4 = 0;
dig_ctrl_3 = 0;
dig_ctrl_2 = 0;
dig_ctrl_1 = 0;
TMOD=0x01;
TL0=0xf6;
TH0=0xFf;
IE=0x82;
TR0=1;
}

void delay()  //To provide a small time delay
{
TMOD=0x01;
    TL0=0x36;
    TH0=0xF6;
    TR0=1;
    while(TF0==0);
    TR0=0;
    TF0=0;
}

void display() interrupt 1  // Function to display the digits on seven segment. For more details refer seven segment multiplexing.
{
TL0=0x36;
    TH0=0xf6;
P2=0xFF;
dig_ctrl_1 = dig_ctrl_3 = dig_ctrl_2 = dig_ctrl_4 = 0;
dig_disp++;
dig_disp=dig_disp%4;
switch(dig_disp)
{

  case 0:
  P2= digi_val[dig_1];
  dig_ctrl_1 = 1;
  break;

  case 1:
  P2= digi_val[dig_2];
  dig_ctrl_2 = 1;
  break;

  case 2:
  P2= digi_val[dig_3];
  dig_ctrl_3 = 1;
  break;

  case 3:
  P2= digi_val[dig_4];
  dig_ctrl_4 = 1;
  break;
}
}

void main()
{
   init();
   while(1)
   {
  if(up==0&&down==1)  //check if up pin is pressed
     {
  test++;
     num=test;
     dig_4=num%10;
  num=num/10;
     dig_3=num%10;
  num=num/10;
     dig_2=num%10;
  dig_1=num/10;
  if(test==9999)
  test=0;
  }
    if(up==1&&down==0)  //check if down pin is pressed
    {
  test--;
     num=test;
     dig_4=num%10;
  num=num/10;
     dig_3=num%10;
  num=num/10;
     dig_2=num%10;
  dig_1=num/10;
  if(test==0)
  test=9999;
  }
}
}

Saturday 21 December 2013

AVR--Alf (Egil Bogen) and Vegard (Wollan)'s RISC processor

* AVR is a modified Harvard architecture RISC  single chip micro controller
*It is a 28 pin narrow DIP IC
*Developed by Atmel in 1996
*AVR introduce the flash program memory for programming
*Atmega16 is equipped with an internal oscillator for driving its clock.

AVR microcontrollers are available in three categories:
1.      TinyAVR – Less memory, small size, suitable only for simpler applications
2.      MegaAVR – These are the most popular ones having good amount of memory (upto 256 KB), higher number of inbuilt peripherals and suitable for moderate to complex applications.
3.      XmegaAVR – Used commercially for complex applications, which require large program memory and high speed.

Thursday 5 December 2013

What is the main task of watch dog timer ?

Watch dog timer is a timer is used to reset the processor in an embedded system.
A timer is set to a large value and is counted down.
When the timer value reaches to zero the processor is reset.

What is mean by kernel ?

The 'heart' of an operating system is called kernel.
Kernel is responsible for task sheduling,inter-task communication,interrupt handling,providing timer service,device management and memory management.