Home > other >  STM32F103R6 + KEIL LED lights simulation LED can't light up
STM32F103R6 + KEIL LED lights simulation LED can't light up

Time:12-23

1, tools: Proteus KEIL 4.10 + 8.6

2, source: compile completed, generated HEX file
 
# include "stm32f10x. H"
# define LED GPIO_Pin_3
Void led_init (void)
{
GPIO_InitTypeDef GPIO_InitStruct.
SystemInit ();
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC,ENABLE);
GPIO_InitStruct. GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_InitStruct. GPIO_Pin=LED;
GPIO_InitStruct. GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init (GPIOC, & amp; GPIO_InitStruct);
}
Int main (void)
{
int i;
led_init();


While (1)
{
GPIO_ResetBits (GPIOC, LED);
For (I=0; I<0 XFFFF; i++);
GPIO_SetBits (GPIOC, LED);
For (I=0; I<0 XFFFF; i++);
}
}


3, Proteus run results:

  • Related