Discussion in "8051 Discussion Forum" started by    wounder    Feb 10, 2020.
Mon Feb 10 2020, 08:32 AM
From below sample code for nuvoton 8051 timer0 mode 0, the isr interval is calculated is 1ms,
its work. but how can I calculate the minimum isr timer interval for 16mhZ frequency.?

#define TH0_INIT 0x1A //[email protected]=16MH
#define TL0_INIT 0xEC

while loading these hex values gets 1ms Isr interval. I was tried 5-microsecond calculation for timer 0, but not get the correct 5uS interval.

#include "N76E003.h"
#include "Common.h"
#include "Delay.h"
#include "SFR_Macro.h"
#include "Function_define.h"

#define TH0_INIT        0x1A //[email protected]=16MH
#define TL0_INIT        0xEC
#define TH1_INIT        0xD7 
#define TL1_INIT        0x0C

*    TIMER 0 interrupt subroutine
void Timer0_ISR (void) interrupt 1          //interrupt address is 0x000B
    TH0 = TH0_INIT;
    TL0 = TL0_INIT;    
   											// GPIO toggle when interrupt
*    TIMER 1 interrupt subroutine
//void Timer1_ISR (void) interrupt 3          //interrupt address is 0x001B
//    TH1 = TH1_INIT;
//    TL1 = TL1_INIT;   
//  P12 = ~P12;																	// GPIO toggle when interrupt
*    Main function 
void main (void)
	//TMOD = 0XFF;
	TIMER0_MODE0_ENABLE;                        //Timer 0 and Timer 1 mode configuration
	TH0 = TH0_INIT;
	TL0 = TL0_INIT;
//	TH1 = TH1_INIT;
//	TL1 = TL1_INIT;
	set_ET0;                                    //enable Timer0 interrupt
	//set_ET1;                                    //enable Timer1 interrupt
	set_EA;                                     //enable interrupts
	set_TR0;                                    //Timer0 run
	//set_TR1;                                    //Timer1 run


[ Edited Mon Feb 10 2020, 08:43 AM ]
Fri Feb 21 2020, 10:05 PM
Did you sort out your problem?

Get Social


Powered by e107 Forum System


Mon Jan 24 2022, 11:41 PM
Horny Shriya
Mon Jan 24 2022, 03:42 AM
Taxi Utrecht Taxibus utrecht Taxi Utrecht is een jonge en dynamische taxicentrale in Utrecht. Wij zijn gespecialiseerd in het aanbieden van op maat gemaakte services op het gebied van taxivervoer in en rondom Utrecht. TaxiBus Utrecht
Sun Jan 23 2022, 04:22 PM
Attractive part of content. I simply stumbled upon your site and in accession capital to say that I acquire actually enjoyed account your blog posts. Anyway I will be subscribing on your feeds and even I success you get right of entry to consistently quickly. https://gkh.dvinaland.ru/forum/user/25793/ http://en.pepeduarte.com/community/profile/monroemallory69/ P1805429 (Zora)
Sun Jan 23 2022, 04:20 PM
I blog often and I really thank you for your information. This great article has really peaked my interest. I will book mark your website and keep checking for new details about once per week. I subscribed to your Feed too. http://agrotrans.5nx.org/viewtopic.php?f=2&t=59222 http://esport-dream-team.eu/index.php?site=shoutbox_content&action=showall Id (Maxie)
Sun Jan 23 2022, 02:13 PM
Hello just wanted to give you a quick heads up and let you know a few of the images aren't loading correctly. I'm not sure why but I think its a linking issue. I've tried it in two different internet browsers and both show the same outcome. https://kramatorsk.iboard.ws/viewtopic.php?id=862 http://logistik.lebedevgroup.com/blog/razdel-1/blog-3/ p2036 (Mikel)



Thu Jun 25 2020, 03:46 PM
Mon Jun 22 2020, 03:03 PM
Tue Jun 16 2020, 05:10 PM
Sat Jun 13 2020, 09:43 PM
Thu May 21 2020, 12:44 PM
Thu May 21 2020, 01:28 AM
Wed May 20 2020, 07:05 PM
Wed May 20 2020, 11:52 AM


Guests: 59, Members: 0 ...

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

Members: 38215
Newest member: Mirza123