Page 47 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 47
#include <stm32f10x.h>
#include <stm32f10x_gpio.h>
void GPIO_Configuration()
{
GPIO_InitTypeDef GPIO_InitStructure;
// Configuration USART1 Tx (PA.09) as althernate
function push-pull
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_9;
GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
// Configuration USART1 Rx (PA.10) as input floating
GPIO_InitStructure.GPIO_Pin = GPIO_Pin_10;
GPIO_InitStructure.GPIO_Mode= GPIO_Mode_IN_FLOATING;
GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
GPIO_Init(GPIOA, &GPIO_InitStructure);
}
③ NVIC.c
#include <stm32f10x.h>
void NVIC_Configuration()
{
//NVIC_InitTypeDef NVIC_InitStructure;
#ifdef VECT_TAB_RAM
NVIC_SetVectorTable(NVIC_VectTab_RAM, 0x0);
#else // VECT_TAB_FLASH
NVIC_SetVectorTable(NVIC_VectTab_FLASH, 0x0);
#endif
- 40 -