Both parameters are 8-bit (0-255) and cannot directly accept 16-bit (0-65535) data.
In order to assign the high 8 bits to TH, the method of dividing by 256 is used, which is equivalent to >> 8 (2 to the 8th power = 256), which is equivalent to moving the high 8 bits to the low 8 bits. The
remainder is calculated to assign the low 8 bits to TL. When it cannot be divided by 256, the remainder range is only within 0-255. So it can be directly assigned to TL.
Therefore,
TH0=(65536-50000)/256;
TL0=(65536-50000)%6;
is equivalent to
TH0=(65536-50000)>>8;
TL0=(65536-50000)&0x00ff;.
During calculation, the microcontroller is more efficient in logical operations than in arithmetic operations.
Previous article:22.1184 crystal oscillator microcontroller
Next article:Setting the slave address of the I2C device
Recommended ReadingLatest update time:2024-11-23 10:24
- Naxin Micro and Xinxian jointly launched the NS800RT series of real-time control MCUs
- How to learn embedded systems based on ARM platform
- Summary of jffs2_scan_eraseblock issues
- Application of SPCOMM Control in Serial Communication of Delphi7.0
- Using TComm component to realize serial communication in Delphi environment
- Bar chart code for embedded development practices
- Embedded Development Learning (10)
- Embedded Development Learning (8)
- Embedded Development Learning (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Intel promotes AI with multi-dimensional efforts in technology, application, and ecology
- ChinaJoy Qualcomm Snapdragon Theme Pavilion takes you to experience the new changes in digital entertainment in the 5G era
- Infineon's latest generation IGBT technology platform enables precise control of speed and position
- Two test methods for LED lighting life
- Don't Let Lightning Induced Surges Scare You
- Application of brushless motor controller ML4425/4426
- Easy identification of LED power supply quality
- World's first integrated photovoltaic solar system completed in Israel
- Sliding window mean filter for avr microcontroller AD conversion
- What does call mean in the detailed explanation of ABB robot programming instructions?
- STMicroelectronics discloses its 2027-2028 financial model and path to achieve its 2030 goals
- 2024 China Automotive Charging and Battery Swapping Ecosystem Conference held in Taiyuan
- State-owned enterprises team up to invest in solid-state battery giant
- The evolution of electronic and electrical architecture is accelerating
- The first! National Automotive Chip Quality Inspection Center established
- BYD releases self-developed automotive chip using 4nm process, with a running score of up to 1.15 million
- GEODNET launches GEO-PULSE, a car GPS navigation device
- Should Chinese car companies develop their own high-computing chips?
- Infineon and Siemens combine embedded automotive software platform with microcontrollers to provide the necessary functions for next-generation SDVs
- Continental launches invisible biometric sensor display to monitor passengers' vital signs
- Why is PCB storage so important?
- Porting OpenCV to TI C6000 DSP
- eMMC Introduction
- Disassemble a smart bracelet
- AD's PCB board has multiple layers. If you want to print it layer by layer, you need to add or delete some layers in PAGE SETUP. There are other quick methods.
- MSP430 MCU realizes stopwatch and uses proteus8.7 simulation
- The national competition has been postponed.
- Unbalanced phase detector principle explanation
- Microchip Motor Control Seminar
- CC2541, BLE protocol stack version 1.3.0, serial port printing DHT11 has problems, how to solve it?