只需一步,快速开始
32
小学生
#include "stm32f4xx.h" int main(void) {
RCC_AHB1ENR |=( 1 << 0);
GPIOA_MODER &=~( (0x03) << (2*15) ); GPIOA_MODER |= ( 1 << (2*15)); GPIOA_ODR |= (1<<15); GPIOA_ODR &=~(1<<15); while(1);}void SystemInit(void){}#define PERIPH_BASE ((unsigned int)0x40000000) #define AHB1PERIPH_BASE (PERIPH_BASE + 0x00020000) #define GPIOA_BASE (AHB1PERIPH_BASE + 0x0000)#define GPIOA_MODER *(unsigned int*)(GPIOA_BASE+0x00)#define GPIOA_OTYPER *(unsigned int*)(GPIOA_BASE+0x04)#define GPIOA_OSPEEDR *(unsigned int*)(GPIOA_BASE+0x08)#define GPIOA_PUPDR *(unsigned int*)(GPIOA_BASE+0x0C)#define GPIOA_IDR *(unsigned int*)(GPIOA_BASE+0x10)#define GPIOA_ODR *(unsigned int*)(GPIOA_BASE+0x14)#define GPIOA_BSRR *(unsigned int*)(GPIOA_BASE+0x18)#define GPIOA_LCKR *(unsigned int*)(GPIOA_BASE+0x1C)#define GPIOA_AFRL *(unsigned int*)(GPIOA_BASE+0x20)#define GPIOA_AFRH *(unsigned int*)(GPIOA_BASE+0x24)
GPIOA_MODER &=~( (0x03) << (2*15) );
GPIOA_MODER |= ( 1 << (2*15));
GPIOA_ODR |= (1<<15); GPIOA_ODR &=~(1<<15); while(1);}void SystemInit(void){}#define PERIPH_BASE ((unsigned int)0x40000000) #define AHB1PERIPH_BASE (PERIPH_BASE + 0x00020000) #define GPIOA_BASE (AHB1PERIPH_BASE + 0x0000)#define GPIOA_MODER *(unsigned int*)(GPIOA_BASE+0x00)#define GPIOA_OTYPER *(unsigned int*)(GPIOA_BASE+0x04)#define GPIOA_OSPEEDR *(unsigned int*)(GPIOA_BASE+0x08)#define GPIOA_PUPDR *(unsigned int*)(GPIOA_BASE+0x0C)#define GPIOA_IDR *(unsigned int*)(GPIOA_BASE+0x10)#define GPIOA_ODR *(unsigned int*)(GPIOA_BASE+0x14)#define GPIOA_BSRR *(unsigned int*)(GPIOA_BASE+0x18)#define GPIOA_LCKR *(unsigned int*)(GPIOA_BASE+0x1C)#define GPIOA_AFRL *(unsigned int*)(GPIOA_BASE+0x20)#define GPIOA_AFRH *(unsigned int*)(GPIOA_BASE+0x24)
GPIOA_ODR |= (1<<15);
GPIOA_ODR &=~(1<<15);
while(1);
}
void SystemInit(void){}#define PERIPH_BASE ((unsigned int)0x40000000) #define AHB1PERIPH_BASE (PERIPH_BASE + 0x00020000) #define GPIOA_BASE (AHB1PERIPH_BASE + 0x0000)#define GPIOA_MODER *(unsigned int*)(GPIOA_BASE+0x00)#define GPIOA_OTYPER *(unsigned int*)(GPIOA_BASE+0x04)#define GPIOA_OSPEEDR *(unsigned int*)(GPIOA_BASE+0x08)#define GPIOA_PUPDR *(unsigned int*)(GPIOA_BASE+0x0C)#define GPIOA_IDR *(unsigned int*)(GPIOA_BASE+0x10)#define GPIOA_ODR *(unsigned int*)(GPIOA_BASE+0x14)#define GPIOA_BSRR *(unsigned int*)(GPIOA_BASE+0x18)#define GPIOA_LCKR *(unsigned int*)(GPIOA_BASE+0x1C)#define GPIOA_AFRL *(unsigned int*)(GPIOA_BASE+0x20)#define GPIOA_AFRH *(unsigned int*)(GPIOA_BASE+0x24)
void SystemInit(void)
{
#define PERIPH_BASE ((unsigned int)0x40000000)
#define AHB1PERIPH_BASE (PERIPH_BASE + 0x00020000)
#define GPIOA_BASE (AHB1PERIPH_BASE + 0x0000)
#define GPIOA_MODER *(unsigned int*)(GPIOA_BASE+0x00)#define GPIOA_OTYPER *(unsigned int*)(GPIOA_BASE+0x04)#define GPIOA_OSPEEDR *(unsigned int*)(GPIOA_BASE+0x08)#define GPIOA_PUPDR *(unsigned int*)(GPIOA_BASE+0x0C)#define GPIOA_IDR *(unsigned int*)(GPIOA_BASE+0x10)#define GPIOA_ODR *(unsigned int*)(GPIOA_BASE+0x14)#define GPIOA_BSRR *(unsigned int*)(GPIOA_BASE+0x18)#define GPIOA_LCKR *(unsigned int*)(GPIOA_BASE+0x1C)#define GPIOA_AFRL *(unsigned int*)(GPIOA_BASE+0x20)#define GPIOA_AFRH *(unsigned int*)(GPIOA_BASE+0x24)
#define GPIOA_MODER *(unsigned int*)(GPIOA_BASE+0x00)
#define GPIOA_OTYPER *(unsigned int*)(GPIOA_BASE+0x04)
#define GPIOA_OSPEEDR *(unsigned int*)(GPIOA_BASE+0x08)
#define GPIOA_PUPDR *(unsigned int*)(GPIOA_BASE+0x0C)
#define GPIOA_IDR *(unsigned int*)(GPIOA_BASE+0x10)
#define GPIOA_ODR *(unsigned int*)(GPIOA_BASE+0x14)
#define GPIOA_BSRR *(unsigned int*)(GPIOA_BASE+0x18)
#define GPIOA_LCKR *(unsigned int*)(GPIOA_BASE+0x1C)
#define GPIOA_AFRL *(unsigned int*)(GPIOA_BASE+0x20)
#define GPIOA_AFRH *(unsigned int*)(GPIOA_BASE+0x24)
使用道具 举报
本版积分规则 发表回复 回帖后跳转到最后一页
联系站长|手机版|野火电子官网|野火淘宝店铺|野火电子论坛 ( 粤ICP备14069197号 )
GMT+8, 2024-11-24 13:04 , Processed in 0.031032 second(s), 26 queries , Gzip On.
Powered by Discuz! X3.4
Copyright © 2001-2021, Tencent Cloud.