CORRECTION-DS-2019

Telechargé par Nasri Jouhaina
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx.h"
/* Private typedef -----------------------------------------------------------*/
GPIO_InitTypeDef GPIO_InitStructure;
int main(void)
{
/* GPIOB Periph clock enable */
RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOB ,ENABLE);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode= GPIO_Mode_IN ;
GPIO_InitStructure.GPIO_Speed= GPIO_Speed_40KHz ;
GPIO_InitStructure.GPIO_OType= GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd= GPIO_PuPd_UP ;
/* Initialisation de la strcture au GPIOB */
GPIO_Init( GPIOB, &GPIO_InitStructure);
RCC_AHB1PeriphClockCmd( RCC_AHB1Periph_GPIOD,ENABLE);
GPIO_InitStructure.GPIO_Pin=GPIO_Pin_2|GPIO_Pin_3;
GPIO_InitStructure.GPIO_Mode= GPIO_Mode_OUT ;
GPIO_InitStructure.GPIO_Speed= GPIO_Speed_2MHz ;
GPIO_InitStructure.GPIO_OType= GPIO_OType_PP;
GPIO_InitStructure.GPIO_PuPd= GPIO_PuPd_UP ;
/* Initialisation de la strcture au GPIOD */
GPIO_Init( GPIOD, &GPIO_InitStructure);
while (1)
{ GPIO_WriteBit( GPIOD, GPIO_Pin_2, Bit_SET);
delayTime(10);// If( GPIO_ReadInputDataBit( GPIOB, GPIO_Pin_3)==0)
{ GPIO_WriteBit( GPIOD, GPIO_Pin_3, Bit_SET); }
}
}
1 / 1 100%

CORRECTION-DS-2019

Telechargé par Nasri Jouhaina
La catégorie de ce document est-elle correcte?
Merci pour votre participation!

Faire une suggestion

Avez-vous trouvé des erreurs dans linterface ou les textes ? Ou savez-vous comment améliorer linterface utilisateur de StudyLib ? Nhésitez pas à envoyer vos suggestions. Cest très important pour nous !