Writing interrupts requires a timer:
1. Set its register TMOD
2. The value of THx and TLx (this is to set the initial value of the timer)
3. Turn on the timer (TRx=1)
-----------------------------
Note: There are two registers in the serial port
SCON (Serial Port Controller) and PCON
4. SCON format: SM0 SM1 SM2 REN TB8 RB8 TI RI
(1) SM0 and SM1 are used to set the serial port working mode: 0, 1, 2, 3, a total of 4 working modes.
(2) SM2 is only used for multi-machine communication control bits in Mode 2 and Mode 3.
(3) REN serial reception enable bit. 0 - Disable reception 1 - Enable reception
(4) TB8: In methods 2 and 3, TB8 is the ninth bit of data to be sent by the transmitter.
(5) RB8: In methods 2 and 3, RB8 is the ninth bit of data received by the receiver, which comes from TB8 of the transmitter.
(6)TI: Transmit interrupt flag. It must be cleared by software before sending. During the sending process, TI remains at zero. After sending a frame of data,
Automatically set to 1 by hardware. If you want to continue sending, you must clear it by software.
(7) RI: Receive interrupt flag. Before receiving, it must be cleared by software. During the receiving process, RI remains at zero. After receiving a frame of data,
Automatically set to 1 by the on-chip hardware. If you need to continue receiving, you must clear it again by software.
Power Control Register (Power Controller)
SMOD bit of PCON: baud rate doubling bit. When calculating the baud rate of serial modes 1, 2, and 3; 0 - do not double; 1 - double.
Previous article:How to use STM8L interrupt line and interrupt port
Next article:STM8L serial port interrupt cannot enter
- Popular Resources
- Popular amplifiers
- 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?
- 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
- Another technical solution for power-type plug-in hybrid: A brief discussion on Volvo T8 plug-in hybrid technology
- How to use high-speed ADC and DAC with FPGA.pdf
- Lisp Badge (uList Badge)
- UART1 idle interrupt exception occurs when STM32F407VE replaces STM32F429VI
- C++ inheritance important understanding
- [SC8905 EVM Evaluation] + Use of the setting tool SC9805tool
- [IDE] Does IAR have a function module similar to Keil's RTE?
- Toshiba TLP3547 Photorelay Review--->> Unboxing
- Recruiting technical experts, are you coming?
- The hardware components of a mobile phone include RF/ABB/DBB/MCU/PMU. What do ABB, DBB and PMU mean?
- FPGA Learning Experience