Discussion in "Software" started by    vijay    Jan 5, 2012.
Thu Jan 05 2012, 02:56 AM
#1
frnds i type this code for generate 1 second delay but it goes to infinite....why?


#include<reg51.h>
void todelay(void);




void main (void)
// timer for 1 second
{
while(1)

todelay();


}






void todelay()
{
TMOD=0x01;

TL0=0xfc;
TH0=0x4b;
TR0=1;
while(TF0==0);
TR0=0;
TF0=0;


}


Thu Jan 05 2012, 04:36 AM
#2
@ vijay.parmar1992
in while(1) loop u only call the delay function that is why it is seems to infinite
u can also use this delay

void delay_ms (unsigned int count)
{
unsigned int i;                          
while(count) 
{
i = 115;
while(i>0) i--;
count--;
}
}


delay_ms(1000); means 1 sec delay

Get Social

Information

Powered by e107 Forum System

Downloads

Comments

jasmeet_singh
Thu Apr 17 2014, 10:19 AM
embeddevil
Thu Apr 17 2014, 08:44 AM
viniciusheidrun
Wed Apr 16 2014, 07:32 AM
Colbee
Tue Apr 15 2014, 04:12 PM
sanket400
Tue Apr 15 2014, 11:21 AM
irfanahmed11
Mon Apr 14 2014, 10:00 PM
my_love
Sun Apr 13 2014, 02:59 PM
manpreet.31
Sun Apr 13 2014, 12:41 PM

Conversation

Thu Apr 17 2014, 12:27 AM
mba'
like the forum and wish to participate
ExperimenterUK
Wed Apr 16 2014, 04:45 PM
@viniciusheidrun..you should read my comment just before your post
viniciusheidrun
Wed Apr 16 2014, 01:43 PM
I'm doing a drive system with SIM900D modem and microcontroller AT89S52 via sms. I'm having trouble can not generate the. Hex to send to the microcontroller, whenever I compile the error, I'm using MCU 8051 IDE, what should I do so that my system receive sms and perform my task?
ExperimenterUK
Mon Apr 14 2014, 01:00 PM
@Haranadh,bipin chandra etc. Create threads for your questions.
Sun Apr 13 2014, 04:05 AM
Haranadh
we bought HC 06 Bluetooth modem instead of Module ,Can any one help me of using it as bluetooth module since i am doing this project?
Sun Apr 13 2014, 03:58 AM
Haranadh
Hi,Actually we bought Bluetooth modem instead of Bluetooth Module
ajay_bhargav
Sat Apr 12 2014, 02:55 PM
Please use forum if you want to ask a question.
Sat Apr 12 2014, 01:06 PM
Dpk
Hi Ahana,I can Help you on this
Sat Apr 12 2014, 03:51 AM
bipin chandra
can anybody help me. we are making a project to control the position of dc motor. so there we need to interface lcd screen and the 4X3 memberane keypad and a dc motor driver chip. can anybody please give me the complete circuit diagram connection of these components with the 8051.and alse help in the programming. my email id is bipin.chandra666@gmail.com
Fri Apr 11 2014, 01:10 PM
humain
will anybody tell me why do we need comma positions to be considered to know about latitude and longitude from gps?
  Choose Skin