工程文件创立的操作完成
(11)在main.c中输入代码(此代码为点亮LED灯的代码)
#define RCC_APB2ENR *(volatile unsigned long *)0x40021018
#define GPIOB_CRL *(volatile unsigned long *)0x40010C00
#define GPIOB_ODR *(volatile unsigned long *)0x40010C0C
int main(void)
{
// 开启端口 B 的时钟
*(unsigned int *)0x40021018 |= (1 << 3);
// 配置 PB0 为通用推挽输出模式,速率为 2M
*(unsigned int *)0x40010C00 |= (1 << (4*0));
// 配置 PB0 为通用推挽输出模式,速率为 2M
*(unsigned int *)0x40010C0C &= ~(1 << 0);
}
void SystemInit(void)
{}
|