Demo02_基于寄存器+标准库开发的项目
#include "stm32f10x.h"
// 基于寄存器+标准库开发的项目了
int main(){// 控制PB1的Led显示RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);GPIO_InitTypeDef initType;initType.GPIO_Pin = GPIO_Pin_10 ;initType.GPIO_Mode = GPIO_Mode_Out_PP;initType.GPIO_Speed = GPIO_Speed_50MHz;GPI O_Init(GPIOB, &initType);while(1){GPIO_SetBits(GPIOB, GPIO_Pin_10);int num = 5000000;while(num > 1){num--;}GPIO_ResetBits(GPIOB, GPIO_Pin_10);// num = 5000000;while(num > 1){num--;}}
}
效果:pB10灯泡闪。