Marquee-bit operation

Publisher:天涯拾遗Latest update time:2019-02-14 Source: eefocus Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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

Reference address:Marquee-bit operation

Previous article:STM32 clock system review
Next article:Marquee Experiment - Register Version

Latest Microcontroller Articles
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号