___________________________________________________________________________________________________
____________________________________________________________________________________________________ 2. CREATING A SQUARE WAVE OF 100 MS USING TIMER 0 OF ATMEGA16 ____________________________________________________________________________________________________ Content for the tab VIDEO
Click Here : understanding of timer/counter as program point of view
1. CREATING A DELAY OF 1 SEC USING timer of ATMEGA 16
/******************************************************
www.firmcodes.com
DEVELOPED BY:- FIRMWARE DEVELOPER
WHAT PROGRAM DO:- CREATING DELAY OF 1 SEC USING TIMER OF ATMEGA16
******************************************************/
#include<avr/io.h>
#include<util/delay.h>
void delay(); // crating delay of 1 sec
void main()
{
DDRD=0xFF;
TCCR0=0x01;
while(1)
{
PORTD=~PORTD;
delay();
}
}
void delay() // creating 1 sec delay
{
int i;
for(i=0;i<5000;i++)
{
TCNT0=0x38;
while((TIFR&0x01)==0);
TIFR=0x01;
}
}
PROTEUS File for SIMULATION(Password Of RAR file is :-firmcodes.com)
/******************************************************
www.firmcodes.com
DEVELOPED BY:- FIRMWARE DEVELOPER
WHAT PROGRAM DO:- CREATING A SQUARE WAVE OF 100 MS USING TIMER 0 OF ATMEGA16
******************************************************/
#include<avr/io.h>
#include<util/delay.h>
void delay(); // crating delay of 50 mili sec sec
void main()
{
DDRD=0xFF;
TCCR0=0x01;
while(1)
{
PORTD|=(1<<0);
delay();
PORTD&= ~(1<<0);
delay();
}
}
void delay() // creating 50 mili sec delay
{
int i;
for(i=0;i<5;i++)
{
TCNT0=0x38;
while((TIFR&0x01)==0);
TIFR=0x01;
}
}
PROTEUS File for SIMULATION(Password Of RAR file is :-firmcodes.com)