1. References
"STM32F1 Development Guide - Library Function Version" - Section 5.2.1 Implementation of Bit-Band Operation of IO Ports
STM32F1xx official information:
"STM32 Chinese Reference Manual V10" - Chapter 8 General and Multiplexed Function IO (GPIO and AFIO)
"Cortex-M3 Definitive Guide (Chinese)" Chapter 5 Bit-band Operation
2. The essential purpose of bit operation is to operate registers
1) Bit operation is more convenient to operate IO port
2) Bit operation principle
Expand each bit into a 32-bit word, and when accessing these words, the access is achieved
The purpose of bits, for example, the BSRR register has 32 bits, so it can be mapped to 32 addresses
In the above example, we access (read-modify-write) these 32 addresses to achieve the purpose of accessing 32 bits.
3) Which regions support bit operations?
One of them is the lowest 1MB range of the SRAM area,
0x20000000 ‐ 0x200FFFFF (lowest 1MB in the SRAM area)
The second is the lowest 1MB range of the on-chip external area.
0x40000000 ‐ 0x400FFFFF (lowest 1MB in the on-chip peripheral area)
4) sys.h implements bit-band operation for GPIO input and output functions
5) The final output operates the ODR register
3. Write code
HARDWARE led.c led.h are all old routines
Directly copy the library function version of the code and modify it.
PBout(5) = 1; //PB5 outputs high level
PBout(5) = 0; //PB5 outputs low level
PEout(5) = 1; //PE5 outputs high level
PEout(5) = 0; //PE5 outputs low level
Previous article:STM32 clock system review
Next article:Marquee Experiment - Register Version
- Popular Resources
- Popular amplifiers
- Learn ARM development(16)
- Learn ARM development(17)
- Learn ARM development(18)
- Embedded system debugging simulation tool
- A small question that has been bothering me recently has finally been solved~~
- Learn ARM development (1)
- Learn ARM development (2)
- Learn ARM development (4)
- Learn ARM development (6)
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- Wiring harness durability test and contact voltage drop test method
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- From probes to power supplies, Tektronix is leading the way in comprehensive innovation in power electronics testing
- Sn-doped CuO nanostructure-based ethanol gas sensor for real-time drunk driving detection in vehicles
- Design considerations for automotive battery wiring harness
- Do you know all the various motors commonly used in automotive electronics?
- What are the functions of the Internet of Vehicles? What are the uses and benefits of the Internet of Vehicles?
- Power Inverter - A critical safety system for electric vehicles
- Analysis of the information security mechanism of AUTOSAR, the automotive embedded software framework
- MSP CapTIvate MCU Development Kit Evaluation Model
- Please tell me, what is the difference between NB-IOT module and NB-IOT chip, what additional features and functions does the former have over the latter?
- 【Home treasure】 esp32s2 freertos communication between tasks Event Groups
- View Circuit-ADC and System (2)
- Hi3559A Flying Camera Solution
- I would like some advice on troubleshooting the mnemonic reading device in the analog circuits book?
- Summary of STM32 serial port sending and receiving data
- A brief explanation of FPGA static timing analysis
- [TI star products limited time sale] + Buy, buy, buy!
- [Xianji HPM6750 Review] CoreMark running test