STM32F103C8T6实现流水灯
一、实验原理
1.1 stm32f103c8t6介绍
STM32F103C8T6是一款由意法半导体公司(ST)推出的基于Cortex-M3内核的32位微控制器,硬件采用LQFP48封装,属于ST公司微控制器中的STM32系列。
1.2 stm32f103c8t6点亮流水灯原理
详细原理参考博客:https://blog.csdn.net/geek_monkey/article/details/86291377.
二、c语言实现
1.项目创建
选择STM32F103C8,后面选择startup和core
2.点击魔法棒,在output里选择create hex file
3.在source group里创建led.c,并写入代码
//--------------APB2使能时钟寄存器------------------------
#define RCC_AP2ENR *((unsigned volatile int*)0x40021018)
//----------------GPIOA配置寄存器 ------------------------
#define GPIOA_CRL *((unsigned volatile int*)0x40010800)
#define GPIOA_ORD *((unsigned volatile int*)0x4001080C)
//----------------GPIOB配置寄存器 ------------------------
#define GPIOB_CRH *((unsigned volatile int*)0x40010C04)
#define GPIOB_ORD *((unsigned volatile int*)0x40010C0C