Answer the question
In order to leave comments, you need to log in
How to light a diode on STM32?
I have an STM32VLD board. For programming I use CooCox 1.7.8.
Googling and sorting through a bunch of examples, I did not understand how to light the idle built-in LED.
Please tell me what am I doing wrong?
#include<stm32f10x_rcc.h>
#include<stm32f10x_gpio.h>
#include "stm32f10x.h"
#include "stm32f10x_conf.h"
GPIO_InitTypeDef GPIO_InitStructure;
volatile int main(void)
{
RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOC, ENABLE);
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9;
GPIO_Init(GPIOC, &GPIO_InitStructure);
GPIO_WriteBit(GPIOC,GPIO_Pin_9,Bit_SET);
}
Answer the question
In order to leave comments, you need to log in
In the iar environment, your code works and the LED on C9 lights up.
As for the code - write an infinite loop at the end - while (1) {} - so that the controller does not complete its work
we.easyelectronics.ru/Frolls/moya-ochered-morgat-s...
easyelectronics.ru/arm-uchebnyj-kurs-porty-gpio.html
www.st.com/content/st_com/en/products/evaluation-t ...
we.easyelectronics.ru/thodnev/prakticheskiy-kurs-s...
we.easyelectronics.ru/STM32/prakticheskiy-kurs-stm...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question