Las familias
STM32F405,
de microcontroladores (MCU)
STM32F407,
STM32F415,
A. Funcionamiento
"stm32f4xx.h"
"stm32f4xx_syscfg.h"
"stm32f4xx_rcc.h"
"stm32f4xx_gpio.h"
"stm32f4xx_exti.h"
"misc.h"
int a=0;
EXTI_InitTypeDef
EXTI_InitStructure;
void EXTILine0_Config(void);
void LEDInit(void);
void delay(int t);
void main(void)
{
LEDInit();
EXTILine0_Config();
GPIO_WriteBit(GPIOA, GPIO_Pin_1, 1);
while (1){}
}
void LEDInit()
{
GPIO_InitTypeDef GPIO_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOD,
ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_12|
GPIO_Pin_13|GPIO_Pin_14|GPIO_Pin_15;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_Init(GPIOD, &GPIO_InitStructure);
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,
ENABLE);
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_100MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
}
void EXTILine0_Config(void)
{
GPIO_InitTypeDef
GPIO_InitStructure;
NVIC_InitTypeDef
NVIC_InitStructure;
RCC_AHB1PeriphClockCmd(RCC_AHB1Periph_GPIOA,
ENABLE);
RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG,
ENABLE);
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_0;
GPIO_Init(GPIOA, &GPIO_InitStructure);
EXTI_InitStructure.EXTI_Trigger =
EXTI_Trigger_Rising;
EXTI_InitStructure.EXTI_LineCmd = ENABLE;
EXTI_Init(&EXTI_InitStructure);
NVIC_InitStructure.NVIC_IRQChannel = EXTI0_IRQn;
NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority
= 0x01;
NVIC_InitStructure.NVIC_IRQChannelSubPriority =
0x01;
NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
NVIC_Init(&NVIC_InitStructure);
}
void delay(int t)
{
while(t>0)
{
t--;
}
}
void EXTI0_IRQHandler(void)
{
if(EXTI_GetITStatus(EXTI_Line0)!= RESET)
{
delay(10000);
if(GPIO_ReadInputDataBit(GPIOA,GPIO_Pin_0)==1)
{
a++;
GPIO_Write(GPIOD,a<<12);
if(a>0xF)
a=0;
}
EXTI_ClearITPendingBit(EXTI_Line0);
}
}
IV. CONCLUSIONES
En conclusin la tarjeta STM32F4-DISCOVERY es
de muy alta calidad con un costo bajo.
La tarjeta viene con un muchas caractersticas de
on-board que hace que el desarrollo mucho ms
rpido y ms fcil. Esto hace que sea posible probar
algunas de las caractersticas del procesador.
REFERENCIAS
[1] http://electronicatk.blogspot.mx/2015/06/placa-stm32f4discovery.html
[2] http://es.rs-online.com/web/p/kits-de-desarrollo-deprocesador-y-microcontrolador/7458434/