Mode 0: 13-bit timer maximum time interval = 2^13 = 8.192ms.
Mode 1: 16-bit timer maximum time interval = 2^16 = 65.536ms.
Mode 2: 8-bit timer maximum time interval = 2^8 = 0.256ms. =256 us.
Timing is 5ms. Calculate the initial value of the timer M = 2^KX*Fosc/12. 12MHz
mode 0: K=13,X=5ms,Fosc=12MHz. Then M = 2^13 - 5*10^(-3)*12*10^6/12= 3192 = 0x0C78.
THx = 0CH,TLx = 78H,
mode 1: K=16,X=5ms,Fosc=12MHz. Then M = 2^16 - 5*10^(-3)*12*10^6/12= 60536 = 0xEC78
THx = ECH,TLx = 78H,
50ms 12MHz THx = 3CH,TLx = B0H,
10ms THx = D8H,TLx = F0H,
Method 2: Maximum time 2^8Fosc/12 = 0.256ms
Where does the decimal number come from?
6MHz One machine cycle 12/6 = 2us
Timing 1ms Counting initial value x
(2^16-x)*2us = 1000us
x = 2^16 - 500, TH, TL can be set to -500
12MHz One machine cycle 12/12 = 1us
12MHz One machine cycle 12/12 = 1us
Timing 50ms Counting initial value x
(2^16-x)*1us = 50000us
x = 2^16 - 50000, TH, TL can be set to -500
Timer Counts the internal crystal frequency
Counter Counts the number of pulses on the external input CPU pin P3.4 (T0) P3.5 (T1) Negative jump plus one
When the crystal oscillator is 6MHz, the maximum counting frequency is 500KHz
Register
1 TH TL
2 TCON
TR0 TR1 Other bits are interrupt control bits
TMOD
GATE C/T1 M1 M0 GATE C/T0 M1 M0
C8051F00X
timer: add 1 for each clock. The clock can be the system clock or 1/12 of the system clock. When a level appears on the
CKCON
pin, start T0. When it is not satisfied, stop T0 and clear it after reading.
Previous article:51 MCU 1 second timing C language program (through debugging)
Next article:Detailed explanation of 51 single-chip microcomputer instruction cycle, machine cycle, and clock cycle
Recommended ReadingLatest update time:2024-11-16 13:40
- Popular Resources
- Popular amplifiers
- Wireless Sensor Network Technology and Applications (Edited by Mou Si, Yin Hong, and Su Xing)
- Modern Electronic Technology Training Course (Edited by Yao Youfeng)
- Modern arc welding power supply and its control
- Small AC Servo Motor Control Circuit Design (by Masaru Ishijima; translated by Xue Liang and Zhu Jianjun, by Masaru Ishijima, Xue Liang, and Zhu Jianjun)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Thank you for being there, thank you for the colorful life in the year
- Does anyone know about ST's new MPU? The model is STM32MP157A
- BlueNRG-x Documentation - Free Development Compiler Tool
- Guihang Shares Huayang Electric Co., Ltd. recruits embedded software and hardware engineers
- Participate in offline forum activities and give a speech on the evolution of semiconductor 5G testing
- [Zero-knowledge ESP8266 Tutorial] Quick Start 10-Dimming with PWM
- RISC-V SoC FPGA architecture brings real-time performance to Linux
- Download address of Guo Tianxiang's video tutorial on learning C51 microcontroller in ten days, which is recognized as the best in China
- The 1965 Tektronix oscilloscope TYPE453 takes you back to the distant past
- A filter to suppress broadcasts shared with forum friends