Email: Password: Remember Me | Create Account (Free)

Back to Subject List

Old thread has been locked -- no new posts accepted in this thread
???
08/06/06 05:58
Read: times


 
#121717 - help with c51
Hello,
This is the first time I'm writing a c code for the keil c51 conpiler so please help me out. Here is a sample delay code I wrote, I guess it is approximately 4 seconds, but the problem is it is not giving a uniform delay. After giving 4seconds delay for 10 times, it gives a delay of 10seconds and then it's back to normal. Also please tell me who to calculate exact delay for c code.
#include <reg51.h>

void delay(void)
{
 int i,j;
  for(j=0;j<10;j++)
   for(i=0;i<32767;i++)
   	i=i;
}
void main(void)
{while(1)
  {
   P1=0x00;
   delay();
   P1=0x0ff;
   delay();
  }
}


Thank you
Ashwin.V

List of 34 messages in thread
TopicAuthorDate
help with c51            01/01/70 00:00      
   Asking the impossible!            01/01/70 00:00      
   killing bad habits from the onset            01/01/70 00:00      
      Delay            01/01/70 00:00      
         Uncommented code is worthless!            01/01/70 00:00      
   No delay            01/01/70 00:00      
      I found this on the web.            01/01/70 00:00      
         Still not \"accurate\"            01/01/70 00:00      
            Sorry aaaaa more Accurate....            01/01/70 00:00      
   but why that weird inconsistency?            01/01/70 00:00      
      why wonder            01/01/70 00:00      
         what's fundamentally wrong on a delay loop?            01/01/70 00:00      
            to keep hacking at fundamentally wrong code serves            01/01/70 00:00      
               argggggggg!!! again.            01/01/70 00:00      
                  HUH?            01/01/70 00:00      
               still does not explain inconsistency            01/01/70 00:00      
                  to Jan            01/01/70 00:00      
               IS it time to put erik out to pasture            01/01/70 00:00      
                  there are many            01/01/70 00:00      
   The best way:            01/01/70 00:00      
   on the subject of timing            01/01/70 00:00      
      The Answer to the OP            01/01/70 00:00      
         Drive-By poster?            01/01/70 00:00      
            Oh how wonderful            01/01/70 00:00      
            Yes Drive-By Poster            01/01/70 00:00      
   char VS int            01/01/70 00:00      
      why do you persist            01/01/70 00:00      
         Learn through your mistakes            01/01/70 00:00      
            yes, I do            01/01/70 00:00      
               inline assembly in C            01/01/70 00:00      
                  sure            01/01/70 00:00      
                  why such figthing ?            01/01/70 00:00      
      write it out            01/01/70 00:00      
      debug            01/01/70 00:00      

Back to Subject List