Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronic Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Register Log in

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

Status
Not open for further replies.

thannara123

Advanced Member level 4
Joined
Jan 7, 2010
Messages
1,455
Helped
120
Reputation
240
Reaction score
111
Trophy points
1,353
Location
God's Own country India, India
Activity points
9,437
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
 

ckshivaram

Advanced Member level 5
Joined
Apr 21, 2008
Messages
5,070
Helped
2,149
Reputation
4,304
Reaction score
2,089
Trophy points
1,393
Location
villingen (Germany) / Bangalore
Activity points
30,097

ckshivaram

Advanced Member level 5
Joined
Apr 21, 2008
Messages
5,070
Helped
2,149
Reputation
4,304
Reaction score
2,089
Trophy points
1,393
Location
villingen (Germany) / Bangalore
Activity points
30,097
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++);
}

 

braydon

Newbie level 2
Joined
Apr 5, 2011
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,288
i want to know how to create one second delay in 89s52
==============
NO SIGNATURE LINK ALLOWED, THIS IS A WARNING
 

cmsrlabs

Junior Member level 3
Joined
Aug 27, 2012
Messages
25
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,436
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.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top