51 MCU interrupt number and timer working mode

Publisher:upsilon30Latest update time:2015-05-19 Source: 51hei Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
Interrupt number                         interrupt 0 external interrupt 0 (EX0)                        interrupt 1 timer/timer interrupt 0 (ET0)                        interrupt 2 external interrupt 1 (EX1)                        interrupt 3 timer/timer interrupt 1 (ET1)                        interrupt 4 serial port interrupt (ES)                                          Timer working mode  1. Mode 0                     is composed of 8 bits of TH0 and the lower 5 bits of TL0 to form a 13-bit timer.                     When the 13-bit timer increases from 0 or the set value to all '1', an overflow occurs when it is increased by 1 again                     . At this time, set the TF0 bit of TCON to 1, and initialize the timer to all '0'   2. Mode 1                     Mode 1 and Mode 0 work the same way, the only difference is that TH0 and TL0 form a 16-bit counter.                     The reset method is the same as method 0.  3. Method 2             configures TL0 as an 8-bit timer that can automatically restore the initial value (initial constants are automatically reloaded)                      . TH0 is used as a constant buffer. TH0 is preset by software. When TL0 overflows, the                     overflow flag is set to 1, and the 8-bit data in TH0 is reloaded into TL0.                               Method 2 is often used for timing control. For example, if you want to generate a timing control pulse every 250us,                     you can use a 12MHz oscillator, preset TH0 to 6, and make C/=0 to achieve it. Method 2                    is not used as a serial port baud rate generator.   4. Method 3             Method 3 is different for timer T0 and timer T1 .             If T1 is set to method 3, it will stop working (the effect is the same as TR1=0),             so method 3 is only applicable to T0 










 

 



















Reference address:51 MCU interrupt number and timer working mode

Previous article:Detailed explanation of single bus protocol (ds18b20) reading and writing
Next article:MCU infrared receiving and decoding program successful version

Recommended ReadingLatest update time:2024-11-16 14:47

STM32L151C8 periodically wakes up from standby mode (RTC Wakeup Timer)
#include "stm32l1xx.h" #include "system_stm32l1xx.h" #include "OLED.h" #include "delay.h" void RtcWakeUpConfig(void); u8 RtcInit(void); u8 RtcConfig(void); int main() {     DelayInit(); //Delay initialization     RCC_APB1PeriphClockCmd(RCC_APB1Periph_PWR, ENABLE); //Enable PWR clock     if(PWR_GetFlagStatus(PWR_FL
[Microcontroller]
PIC18F25K80, timer0 timer interrupt
volatile uint32_t uwTick = 0;  void __interrupt() ISR(void)  //void attribute ( (interrupt, no_auto_psv) ) _T1Interrupt( void ) {  if((T0IF)&&(T0IE)) //Timer  {     TMR0IF=0;               //T0CON=0B10010011;    //enable T0,16bit,FSCO/4,16:1     TMR0H=0x9E;          //40549(0x9E65)---   (65536-40549+13)*0.25*16=10
[Microcontroller]
C51 Timer usage and generation of 1ms system tick
When GATE=0, TR0 and TR1 are used to control the start of T1 and T0, and when GATE=1, external interrupts are used for control. When C/T is 0, it indicates timer mode. When C/T is 1, it indicates counter mode, which counts the external negative transition pulses of T0 or T1. Calculation of the timer initial value: TH
[Microcontroller]
C51 Timer usage and generation of 1ms system tick
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号