/*
developed by S4silver
license type - open source
created on - 11/12/2014
modified on - 11/14/2014
modification details - refactored
developer - Frank Hust Jincson
contact mail id - silverembeddedsolutions@gmail.com
web link - http://s4silver.blogspot.in/p/programmers-colony.html
*/
#include <REGX51.H>
unsigned int c=0;
void timer1_isr() interrupt 3
{
#include <REGX51.H>
unsigned char c;
void timer1_isr() interrupt 3
{
c++;
TF1 = 0; // clrear Timer overflow flag
}
void main()
{
P0=0x00;
TMOD = 0x20; // timer mode setting
TH1 = 20; // put value in Timer 1 high byte
TL1 = 3; // put value in Time 1 low byte
TR1 = 1; // run the timer
while(1)
{
if(c<1000)
P0=0x00;
else
P1=0xff;
}
}
c++;
if(c==20000)c=0;
TF1 = 0; // clrear Timer overflow flag
}
void main()
{
P0=0x00;
TMOD = 0x20; // timer mode setting
TH1 = 0xAA; // put value in Timer 1 high byte
TL1 = 0xFD; // put value in Time 1 low byte
TR1 = 1; // run the timer
IE = 0x88;
while(1)
{
if(c<10000)
P0=0x00;
else P0=0xff;
}
}
No comments:
Post a Comment