当前位置:网站首页>Stm32f10x -- C Language-1
Stm32f10x -- C Language-1
2022-07-27 11:29:00 【YovaVan】
review 51 Single chip microcomputer :
Register mapping : The memory corresponding to each peripheral has an address , By keyword ( for example sfr) Implement register mapping , Name the address .
MCU has port (51 Yes 4 individual ), The corresponding address 0x80,0x90,0xA0,0xB0, adopt
sfr P0 = 0x80;
sfr P1 = 0x90;
sfr P2 = 0xA0;
sfr P3 = 0xB0;Implement register definition . Use directly when programming P0 Assign a value , Such as :
P0 = 0xFE; /*51 Only 8 bits,0b11111110*/STM32F103:
Let someone GPIO Port of 16 Pin implementation high / Low level output ( meanwhile ):
( port ) Output data register ODR(output data register), low 16 Bit effective ,16 All pins output low level, so it is necessary to turn low 16 The bits are set to 1 that will do .
The connection indicator of your board is GPIOE, stay “ Bus architecture ” Port found E Address range : 0x40011800-0x40010FFE.
Address offset : The offset of the register from the bus base address , Here is 0x4001180C.
(unsigned int *) The role of : Cast
GPIOE_ODR The address is 0x4001180C, The compiler does not consider it an address , So we need to use
(unsigned int *)0x4001180C;Yes 0x4001180C Cast .
“*” The role of : Pointer the address . namely :
*(unsigned int*)0x4001180C; The above is the most basic and cumbersome implementation , You can optimize with macro definitions . The box #define Address (unsigned int *)0x4001180C Defined as a macro , sentence :
#define GPIOE_ODR (unsigned int*)0x4001180C; Then operate the macro with pointer and assign value , sentence :
* GPIOE_ODR = 0xFF;You can put the previous sentence * Move the number to the macro definition statement , namely :
#define GPIOE_ODR *(unsigned int*)0x4001180C; Direct assignment :
GPIOE_ODR = 0xFF;边栏推荐
- 容斥原理 AcWing 890. 能被整除的数
- "My" bug collection (Reprinted)
- Find the combination number acwing 888. find the combination number IV
- 2022 Niuke multi school (3) j.journey
- Raw socket grabs packets, and packets on some ports cannot be caught
- ACM warm-up Exercise 2 in 2022 summer vacation (summary)
- Instructions for mock platform
- The longest ascending subsequence model acwing 1017. The glider wing of the strange thief Kidd
- Introduction to software vulnerability analysis (I)
- Game theory acwing 894. Split Nim game
猜你喜欢

JVM judges that the object is dead, and practices verify GC recycling

Digital triangle model acwing 275. pass note

Force buckle - 10. Regular expression matching

高斯消元 AcWing 884. 高斯消元解异或线性方程组

树形DP AcWing 285. 没有上司的舞会

tensorflow运行报错解决方法

数字三角形模型 AcWing 1015. 摘花生

背包模型 AcWing 423. 采药

深析C语言的灵魂 -- 指针

Inclusion exclusion principle acwing 890. divisible numbers
随机推荐
Find the combination number acwing 888. find the combination number IV
Gaussian elimination acwing 884. Gaussian elimination for solving XOR linear equations
数字三角形模型 AcWing 1027. 方格取数
What changes will metauniverse bring to the music industry in the trillion market?
What is the issuing price of NFT (Interpretation of NFT and establishment of NFT world outlook)
ethereum rpc
Knapsack model acwing 423. Picking herbs
8 find subsequences with a maximum length of K
【着色器实现Shake随机摇动效果_Shader效果第十篇】
The article will not keep VIP charges all the time. It will be open for a period of time
Instructions for mock platform
JVM judges that the object is dead, and practices verify GC recycling
中国剩余定理 AcWing 204. 表达整数的奇怪方式
Properties file
Basic use of cmake
349两个数组的交集和01两数之和
Find the combination number acwing 886. find the combination number II
Where is the big data open source project, one-stop fully automated full life cycle operation and maintenance steward Chengying (background)?
最长上升子序列模型 AcWing 482. 合唱队形
最长上升子序列模型 AcWing 1017. 怪盗基德的滑翔翼