[SOLVED] how to create ONE second delay program in keil

Status
Not open for further replies.

thannara123

Advanced Member level 5
Joined
Jan 7, 2010
Messages
1,580
Helped
122
Reputation
244
Reaction score
114
Trophy points
1,353
Location
India
Activity points
10,383
Hai experts ,
i want to know how to create one second delay in 89s52 .my IDE is Keil ?
please give the calculation if you have thanks
 

How i haven't any idea .please help me
 

sir any idea how to calculate it
 

measure this is keil or in oscilloscope


Code C - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#include <REGX51.H>
void msdelay(unsigned int );
void main(){
 
P2=0×00;  //all pin of PORT2 declared as output
//infinite loop
while(1){
 
P2=0xFF;   //all pin high
msdelay(250);    //delay
P2=0×00;   //all pin low
msdelay(250); //delay
 
}
}
 
//delay function
void msdelay(unsigned int value){
 
unsigned int x,y;
for(x=0;x<value;x++)
for(y=0;y<1275;y++);
}

 
...and see example6 for example:
**broken link removed**
 

i want to know how to create one second delay in 89s52
==============
NO SIGNATURE LINK ALLOWED, THIS IS A WARNING
 

Hello

I am designing a precision stop watch with 1 msec precision. I had tried stop watch with 1 msec timer and interrupt.I have checked and upto 1 minute i get exact delay with an error of 100-200 msec and as time passes error increases and after 5 minutes an error of 1 to 5 second is there..

I checked in keil and it shows a delay of exact 1.00000 mecs. but when i checked after 15000 count it shows 15.300 secs. I am not able to understand why this error occurs. please tell me what would be the reason. I am using C lang with code format as

Int ISR() //1 msec interrupt
{
count++;
if(count>=15000) // 15 seconds---> but in keil it shows 15.300 secs.
}
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…