程序编写完过后,没有报错。但是下载到开发版中,灯不亮。看了一下代码,基本和教程上的一样。但是开发板没反应。求助啊!!
找了好久的错,没找到。
#include "stm32f10x.h"
int main(void)
{
RCC_APB2ENR |= (1<<3);/*GPIO时钟*/
GPIOB->CRL &= ~ (0x0f<<(4*0));
GPIOB->CRL |= ((1)<<(4*0));
GPIOB->ODR &= ~(1<<0);
}
void SystemInit(void)
{
}
#define PERIPH_BASE ((unsigned int)0x40000000)
#define APB2PERIPH_BASE PERIPH_BASE+0X10000
#define AHBPERIPH_BASE PERIPH_BASE+0X20000
#define RCC_BASE AHBPERIPH_BASE +0X1000
#define GPIOB_BASE APB2PERIPH_BASE +0X0C00
#define RCC_APB2ENR *(unsigned int*)(RCC_BASE +0X18)
#define GPIOB_CRL *(unsigned int*)(GPIOB_BASE +0X00)
#define GPIOB_CRH *(unsigned int*)(GPIOB_BASE +0X04)
#define GPIOB_ODR *(unsigned int*)(GPIOB_BASE +0X0C)
#define GPIOB_BSRR *(unsigned int*)(GPIOB_BASE +0X10)
#define GPIOB_BRR *(unsigned int*)(GPIOB_BASE +0X14)
typedef unsigned int uint32_t;
typedef unsigned short uint16_t;
typedef struct
{ uint32_t CRL;
uint32_t CRH;
uint32_t IDR;
uint32_t ODR;
uint32_t BSRR;
uint32_t BRR;
uint32_t LCKR;
} GPIO_TypeDef;
#define GPIOB ((GPIO_TypeDef*)GPIOB_BASE) |