这不是我们的模版讲解的吧??
你干嘛在main里面加入:#include "stm32f10x.h"
参考我们手册讲解
copy如下代码到main里面覆盖其他的就可以了!
出了问题,请仔细看手册:
“
18.这次在编译之前,我们记得打开工程USER下面的main.c,复制下面代码到main.c覆盖已有代码,然后进行编译。(记得在代码的最后面加上一个回车,否则会有警告)
”
#include "stm32f10x.h"
GPIO_InitTypeDef GPIO_InitStructure;
int main(void)
{
SystemInit();
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOD, ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_2;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_Init(GPIOD, &GPIO_InitStructure);
while (1)
{
/* Set PD0 and PD2 */
GPIOD->BSRR = 0x00000005;
/* Reset PD0 and PD2 */
GPIOD->BRR = 0x00000005;
}
}
#ifdef USE_FULL_ASSERT
void assert_failed(uint8_t* file, uint32_t line)
{
while (1)
{
}
}
#endif
|