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

Conversation

Sat Sep 20 2014, 02:20 AM
1
-1'
Sat Sep 20 2014, 02:19 AM
-1'
1
ExperimenterUK
Sat Sep 13 2014, 12:34 PM
jaimin1212,Pimpalkhare Create a thread for your question
jaimin1212
Sat Sep 13 2014, 02:35 AM
i want to make self balancing robot using MPU6050 using atmega8.. please help to get data of gyro and accelerometer from this sensor through atmega8.
Thu Sep 11 2014, 09:00 AM
Sunil Pimpalkhare
Hello sir, I am trying to make Wearfin project https://www.youtube.com/watch?v=iZ6PVBvQf-g so can u help me in teaching how to built the program???
Thu Sep 11 2014, 02:21 AM
hariom panday
plz hlp me in my project
iec.naga
Tue Sep 09 2014, 01:19 AM
spi
Mon Sep 08 2014, 08:14 AM
fameem
water changing in fish tank automatically using microcontoller with timer. send idea to me
dexter_a
Sat Sep 06 2014, 11:09 AM
hello guys
Sat Sep 06 2014, 10:10 AM
munaxa
plx guide me

Downloads

Comments

deepbhadani
Fri Sep 19 2014, 01:08 PM
desaiakshay92
Fri Sep 19 2014, 12:45 AM
Fiddu
Thu Sep 18 2014, 02:28 AM
piku_123
Tue Sep 16 2014, 11:29 AM
qudor
Tue Sep 16 2014, 11:06 AM
sara_seecs
Tue Sep 16 2014, 10:53 AM
akshar
Fri Sep 12 2014, 12:45 PM
iec.naga
Tue Sep 09 2014, 01:09 AM

Online

Guests: 36, Members: 0 ...

most ever online: 182184
(Members: , Guests: 182184) on 06 Aug 2010: 01:37 AM

Members: 37517
Newest member: deepbhadani
Forum Activity
kirangowle Avatar
Posted By kirangowle
Sat Sep 20 2014, 12:35 AM
Hello All,I want to connect normal speaker (as a s...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Sep 17 2014, 12:59 AM
I think its important to list out the features of ...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed Sep 17 2014, 12:45 AM
you need to put a wait condition in ISR till the s...
akshar Avatar
Posted By akshar
Mon Sep 15 2014, 04:41 AM
sir,i used microcontroller 89v51rd2 in circuit. No...
bobparihar Avatar
Posted By bobparihar
Mon Sep 15 2014, 02:24 AM
i am programming interrupt 0 using 8051my task is....
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat Sep 13 2014, 12:23 PM
There may not be an exact equivalent .You will hav...
akshar Avatar
Posted By akshar
Sat Sep 13 2014, 03:18 AM
Sir, Good Morning,Thank you for making me a member...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Sep 11 2014, 12:52 AM
which compiler are you using? I suggest XC8 with M...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Sep 11 2014, 12:49 AM
I always prefer Olimex Dev boards when it comes to...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu Sep 11 2014, 12:44 AM
master will always lower down the Chip select... s...