Page 289 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 289
}
void USART2_Configuration(void)
{
USART_InitTypeDef USART_InitStructure;
USART_InitStructure.USART_BaudRate = 9600;
USART_InitStructure.USART_WordLength = USART_WordLength_8b;
USART_InitStructure.USART_StopBits = USART_StopBits_1;
USART_InitStructure.USART_Parity = USART_Parity_No ;
USART_InitStructure.USART_HardwareFlowControl =
USART_HardwareFlowControl_None;
USART_InitStructure.USART_Mode = USART_Mode_Rx | USART_Mode_Tx;
USART_Init(USART2, &USART_InitStructure);
USART_ITConfig(USART2, USART_IT_RXNE, ENABLE);
USART_Cmd(USART2, ENABLE);
NVIC_EnableIRQ(USART2_IRQn);
}
void USART1_IRQHandler(void)
{
if(USART_GetITStatus(USART2, USART_IT_RXNE) ==SET)
{
if((USART1->DR)=='!') isname=1;
else if((USART1->DR)=='@') isname=0;
else
{
if(isname==1)
usart_name[usart_last_cursor][record]=USART1->DR; //name이라면..
if(isname==0)
usart_gap[usart_last_cursor][record]=USART1->DR; //gap이라면...
record++; //배열1증가
if(record>9) record=0; //10칸 도달시 //0부터 다시 시
작...
}
}
}
void USART2_IRQHandler(void)
{
if(USART_GetITStatus(USART2, USART_IT_RXNE) ==SET)
{
- 282 -