关于如何新建使用标准固件库的工程,请参阅:https://zh.arslanbar.net/post.php?t=24015
【程序代码——main.c】
#include <stm32f10x.h>
void delay()
{
    uint32_t i;
    for (i = 0; i < 2000000; i++);
}
int main(void)
{
    GPIO_InitTypeDef init;
    RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB, ENABLE);
    init.GPIO_Pin = GPIO_Pin_All;
    init.GPIO_Speed = GPIO_Speed_50MHz;
    init.GPIO_Mode = GPIO_Mode_Out_PP;
    GPIO_Init(GPIOB, &init);
    while (1)
    {
        GPIOB->ODR = 0x100;
        do
        {
            delay();
            GPIOB->ODR <<= 1;
        } while (GPIOB->ODR); // 只要PB中有1位为1, 循环就继续进行
    }
}
      
