Page 191 - 3-1
P. 191
USART_Mode_Tx;
USART_Init(USART1, &USART_InitStructure);
USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);
USART_Cmd(USART1, ENABLE);
/* DIR485_L; */
/* Enable USART1 global interrupt */
NVIC_EnableIRQ(USART1_IRQn);
// USART 설정
}
void RCC_Configuration()
{
SystemInit();
RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1 | RCC_APB2Periph_GPIOA |
RCC_APB2Periph_GPIOE, ENABLE);
RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);
// Clock 을 각 포트에 Enable 시킴.
}
void Init_All_Periph()
{
RCC_Configuration();
GPIO_Configuration();
NVIC_Configuration();
TIM_Configuration();
USART1_Configuration();
}
void delay_us(unsigned int delay)
{
while(delay--);
}
int main(void)
{
Init_All_Periph();
- 191 -