
F407_05_位带操作
发布日期:2021-05-07 14:37:20
浏览次数:19
分类:精选文章
本文共 1878 字,大约阅读时间需要 6 分钟。
?????????
??GPIOF?ODR?????
???LED??????GPIOF?ODR????????????????????
?ODR?????????GPIOF_ODR??????????GPIOF_ODR????0x40021400 + 0x14
?
??ODR????????????????bit9????
????????bit9???0?????????*GPIOF_ODR = (*GPIOF_ODR) & (~(1 << 9))
?
??ODR?????????????
?????????????????????????????????????????????????????????
Cortex-M4?????
?Cortex-M4?????????Peripheral??????????????
????Bit Band Region??
- ??4??????????
- ????????????????
??????Bit Band Alias??
- ???????????????
- ???????????????????????
?????1bit????
??????????????????????????????
unsigned int *room = (unsigned int *)(0x42000000);*room = 1; // ????0x40000000~0x40000004?bit0??1
??????????????????????????
?GPIOF?ODR?bit9????????
??GPIOF_ODR????0x40021400 + 0x14
??????????????????????
????????
????? =(0x40021414 - 0x40000000) * 32 + 0x42000000
???0x40021414
?GPIOF_ODR?????????? ??bit9???
bit9?? =(0x40021414 - 0x40000000) * 32 + 0x42000000 + 4 * 9
???4 * 9
???bit9??bit???4???? ?????
??????? = 0x42000000 + ((????? - 0x40000000) * 32) + (??? * 4)
??LED
unsigned int *GPIOF_ODR = (unsigned int *)(((0x40021400 + 0x14 - 0x40000000) * 32 + 0x42000000) + 4 * 9);while (1) { // ???? *GPIOF_ODR = 0x1; // ??bit9?1 delay(1000000); // ???? *GPIOF_ODR = 0x1; // ??bit9?1 delay(10000000); // ???? *GPIOF_ODR = 0x0; // ??bit9 delay(10000000); // ???? *GPIOF_ODR = 0x0; // ??bit9 delay(10000000); }
???????*GPIOF_ODR = 0x10
????????????????????????
?????
?RCC???????????????????????????
/* stm32f4xx.h */#define PERIPH_BASE ((uint32_t)0x40000000)#define PERIPH_BB_BASE ((uint32_t)0x42000000)#define AHB1PERIPH_BASE (PERIPH_BASE + 0x00020000)#define RCC_BASE (AHB1PERIPH_BASE + 0x3800)/* stm32f4xx_rcc.c */#define CR_OFFSET (RCC_BASE - PERIPH_BASE)#define CR_HSION_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (HSION_BitNumber * 4))
??????????????????????????????
发表评论
最新留言
关注你微信了!
[***.104.42.241]2025年04月25日 11时58分38秒
关于作者

喝酒易醉,品茶养心,人生如梦,品茶悟道,何以解忧?唯有杜康!
-- 愿君每日到此一游!
推荐文章
leaflet叠加geojson图层(挖洞)(leaflet篇.43)
2025-04-04
leaflet接入土地资源(leaflet篇.55)
2025-04-04
leaflet面采集与面编辑(leaflet篇.7)
2025-04-04
leaflet饼状图(leaflet篇.74)
2025-04-04
Leedcode3- Max Points on a Line 共线点个数
2025-04-04
LeetCode OJ:Merge k Sorted Lists(归并k个链表)
2025-04-05
leetcode Plus One
2025-04-05
LeetCode Text Justification
2025-04-05
Leetcode | Simplify Path
2025-04-05
LeetCode – Refresh – 4sum
2025-04-05
leetCode 字符串反转
2025-04-05
leetcode 验证回文字符串 java实现
2025-04-05
LeetCode(229):Majority Element ||
2025-04-05
leetcode--
2025-04-05
LeetCode--020--括号匹配
2025-04-05
Leetcode-966 Vowel Spellchecker(元音拼写检查器)
2025-04-05
LeetCode111.二叉树最小深度
2025-04-05
LeetCode13:罗马数字转整数
2025-04-05
leetcode23-合并K个升序链表
2025-04-05
LeetCode268.缺失数字
2025-04-05