Discussion in "8051 Discussion Forum" started by    sachinmm    Jun 27, 2015.
Sat Jun 27 2015, 05:09 AM
#1
how calculate 1 second delay in 8051 by using timer and what value should be store in TH0 & TLO register??
Tue Jun 30 2015, 05:45 PM
#2
The 8051 timer can't do 1 second.
It can do 50ms, so set up the interrupt handler to count 20 times .
Fri Jul 03 2015, 09:34 AM
#3
Here you have an example using timer 0:

void delay_ms (unsigned char ms) 	
{
	unsigned int MS = ms;
	while (MS){
		TMOD &= 0xF0;
		TMOD |= 0x01;
		ET0 = 0;
		TH0 = 254;
		TL0 = 35;
		TF0 = 0;
		TR0 = 1;	
		while(TF0==0);
		MS--;
	}
	TR0 = 0;
}


You just need to insert how many miliseconds you want or you can change the values in TH0 e TL0 to reduce the cicle.

Hope this help.

Get Social

Information

Powered by e107 Forum System

Conversation

Mon Apr 12 2021, 11:54 AM
Joe N
I have recently launched my own site, and I am looking to provide value for you for free, by giving away 26 professional level blog post templates (worth $297).
Mon Apr 12 2021, 09:24 AM
Aretha
Hey, I think your site might be having browser compatibility issues. When I look at your website in Ie, it looks fine but when opening in Internet Explorer, it has some overlapping. I just wanted to give you a quick heads up! Other then that, very good blog! https://onanadiete.ru/alpha-numeric-reasoning-questions-and-answers-pdf.pdf alpha numeric reasoning questions and answers pdf alpha numeric reasoning questions and answers pdf

Downloads

Comments

Mirza123
Thu Jun 25 2020, 03:46 PM
eunicelove124
Mon Jun 22 2020, 03:03 PM
cerouno
Tue Jun 16 2020, 05:10 PM
Marce
Sat Jun 13 2020, 09:43 PM
Davidthils
Thu May 21 2020, 12:44 PM
Jakeror
Thu May 21 2020, 01:28 AM
motorCar
Wed May 20 2020, 07:05 PM
Vordrync
Wed May 20 2020, 11:52 AM

Online

Guests: 85, Members: 0 ...

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

Members: 38215
Newest member: Mirza123