Apr 5, 2013 #1 P pradeep221899 Newbie level 1 Joined Sep 7, 2012 Messages 1 Helped 0 Reputation 0 Reaction score 0 Trophy points 1,281 Activity points 1,285 I want to generate delay of 5 minutes in 8051 in C .i'm using KEIL software.. How can i do it? waiting for your reply..... Thanks..
I want to generate delay of 5 minutes in 8051 in C .i'm using KEIL software.. How can i do it? waiting for your reply..... Thanks..
Apr 5, 2013 #2 bassa Super Moderator Staff member Joined Jul 15, 2007 Messages 1,815 Helped 191 Reputation 402 Reaction score 156 Trophy points 1,353 Location Sri Lanka Activity points 11,242 There are many ways to do this Ex: create 60ms delay using timers and loop until 5000 If your crystal = 12 MHz then check this sample code Code C++ - [expand]1 2 3 4 5 6 7 8 9 10 11 12 13 14 delay_5m() { int d; for(d=0;d<=5000;d++) { TMOD=0x01; TL0=0xA0; TH0=0x15; TR0=1; while(TF0==0); // run until TF turns to 1 TR0=0; TF0=0; } }
There are many ways to do this Ex: create 60ms delay using timers and loop until 5000 If your crystal = 12 MHz then check this sample code Code C++ - [expand]1 2 3 4 5 6 7 8 9 10 11 12 13 14 delay_5m() { int d; for(d=0;d<=5000;d++) { TMOD=0x01; TL0=0xA0; TH0=0x15; TR0=1; while(TF0==0); // run until TF turns to 1 TR0=0; TF0=0; } }