本帖最后由 kzlzqi 于 2023-5-31 16:10 编辑
更改main.c文件为一下内容即可
- #include "stm32f10x.h"
- #include "sys.h"
-
- /*------------------------------------------------------------
- 主函数
- ------------------------------------------------------------*/
- int main()
- {
- RCC->APB2ENR|=0X0000001c;//先使能外设IO PORTa,b,c时钟
-
- RCC->APB2ENR |= 1 << 12;
- GPIOB->CRH=0X00030000; //设置GPIOB的12引脚为推挽输出
- while (1)
- {
- delay_ms(100);
- GPIOB->ODR = ~(1 << 12); //设置12引脚输出0
- delay_ms(100);
- GPIOB->ODR |= 1 << 12; //设置12引脚输出1
- }
- }
|