Discussion in "Software" started by    vijay    Jan 5, 2012.
Thu Jan 05 2012, 07: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, 09: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

ExperimenterUK
Mon May 25 2015, 06:21 PM
@Subrat Sahu not a simple answer.Create a thread in "General help Guidance and Discussion" forum
Sun May 24 2015, 06:51 AM
Subrat Sahu
I have a confusion about 10 bit adc formula as describe bellow that resolution = Vref/1023 or Vref / 1024
ExperimenterUK
Sat May 23 2015, 08:54 PM
@utpal.. Create a thread in the Pic forum
Thu May 21 2015, 01:04 AM
utpal
i am a hobbist. i work on 8051. just i have started with pic 16f877. but a bitter experiance is going on. as i am programming any code to my pic877 and putting it in my board and it is working, but the 2nd time it is not taking any program,I have experimented just 7 new one pic mcus. result is the same. please tell me the reason. my programmer is TOP3000(universal programmer).
ajay_bhargav
Wed May 20 2015, 04:48 AM
@lak you can use the same code provided you are not using any s52 specific ports and registers.
Mon May 18 2015, 05:58 AM
lak
i used to develop a code for at89s52 shall i use the same code for at89c4051
Sun May 17 2015, 07:57 AM
Ayoosh
what if i have to rotate motor continuously at a step angle of 1.8 degree
ExperimenterUK
Fri May 15 2015, 06:02 PM
@oracle1946.. Post your question in the PIC forum
Fri May 15 2015, 03:48 AM
nadeem232
if some has solution kindly share solution Principles of Electric Circuits,by Thomas L. Floyd
oracle1946
Thu May 14 2015, 03:39 PM
I want to build a PIC16F684 sun logger using either a solar cell (0.5v solar cell or photoresistor). Any help out there?

Downloads

Comments

vipinpathakg
Wed May 27 2015, 05:57 AM
MuhammadTanvir
Sun May 24 2015, 11:02 AM
as_rog
Sun May 17 2015, 08:00 AM
oracle1946
Thu May 14 2015, 03:34 PM
kakaru32
Tue May 12 2015, 04:29 PM
Yateesh
Sat May 09 2015, 02:46 AM
scmg
Fri May 08 2015, 06:40 PM
OMERO
Fri May 08 2015, 11:53 AM

Online

Guests: 47, Members: 0 ...

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

Members: 37662
Newest member: vipinpathakg
Forum Activity
diana1234 Avatar
Posted By diana1234
Thu May 28 2015, 11:15 AM
Hello there,I am using a MCU LPC2468/78 and in its...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu May 28 2015, 05:06 AM
UDN2981 is an 8-channel driver which can source cu...
ajay_bhargav Avatar
Posted By ajay_bhargav
Thu May 28 2015, 04:53 AM
[Topic moved to Electronics forum]
vipinpathakg Avatar
Posted By vipinpathakg
Wed May 27 2015, 04:25 PM
UDN2981 IC is not available in local market. pleas...
ajay_bhargav Avatar
Posted By ajay_bhargav
Wed May 27 2015, 02:17 PM
UDN2981 is required to drive the LED matrix, are y...
vipinpathakg Avatar
Posted By vipinpathakg
Wed May 27 2015, 06:28 AM
I have created all the hardware of 5x7 LED Dotmatr...
ExperimenterUK Avatar
Posted By ExperimenterUK
Mon May 25 2015, 06:16 PM
We need to do some simple tests.Get the speaker to...
mayank058 Avatar
Posted By mayank058
Mon May 25 2015, 04:57 AM
Dear sir, I am taking output from PI...
MuhammadTanvir Avatar
Posted By MuhammadTanvir
Sun May 24 2015, 11:11 AM
Hey guys !! Can somebody please share the proteus ...
ExperimenterUK Avatar
Posted By ExperimenterUK
Sat May 23 2015, 09:52 PM
Does the speaker work?.'Exactly' where on the boa...