stm32f4xx.h #define RCC_AHBIENR*(unsigned int*)(0x40023800+0x30)#define GPIO_MODER *(unsigned int*)(0x40021400+0x00) #define GPIO_ODR *(unsigned int*)(0x40021400+0x14) main.c #include "stm32f4xx.h"/*//寄存器点灯int main(void){//第一步
stm32f4xx.h
#define RCC_AHBIENR *(unsigned int*)(0x40023800+0x30)
#define GPIO_MODER *(unsigned int*)(0x40021400+0x00)
#define GPIO_ODR *(unsigned int*)(0x40021400+0x14)
main.c
#include "stm32f4xx.h"
/*
//寄存器点灯
int main(void)
{
//第一步:打开GPIOF端口的时钟
RCC |=(1<<5);
//第二步:控制GPIO的方向
//GPIOF 配置为输出
*(unsigned int*)(0x40021400+0x00) &=~((~0x03)<<(2*6));
*(unsigned int*)(0x40021400+0x00) |=(1<<(2*6));
//第三步:控制GPIO的数据输出寄存器
//PF6输出高电平
*(unsigned int*)(0x40021400+0x14) |=(1<<6);
//PF6输出低电平
*(unsigned int*)(0x40021400+0x14) &= ~(1<<6);
}
*/
/*
//增加宏定义后
int main(void)
{
//第一步:打开GPIOF端口的时钟
RCC_AHBIENR |=(1<<5);
//第二步:控制GPIO的方向
//GPIOF 配置为输出
GPIO_MODER &=~((~0x03)<<(2*6));
GPIO_MODER |=(1<<(2*6));
//第三步:控制GPIO的数据输出寄存器
//PF6输出高电平
GPIO_ODR |=(1<<6);
//PF6输出低电平
GPIO_ODR &= ~(1<<6);
}
*/
void SystemInit(void)
{
/*函数体为空,目的是为了骗过编译器不报错*/
}