Page 984 - 완) I MDP 프로젝트 작품 보고서(전체과 1학년)1.6
P. 984

GPIO_Init(GPIOA, &GPIO_InitStructure);

                    /*USART*/
            }


            void USART1_Configuration(){//USART설정

                    USART_InitTypeDef USART_InitStructure;


                    /*Enable USARTx clock*/
                    //RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,Enable);


                    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_Mode = USART_Mode_Rx | USART_Mode_Tx;

                    USART_InitStructure.USART_HardwareFlowControl                                           =
            USART_HardwareFlowControl_None;


                    USART_Init(USART1, &USART_InitStructure);
                    USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);



                    USART_Cmd(USART1, ENABLE);


                    NVIC_EnableIRQ(USART1_IRQn);
            }



            void USART1_IRQHandler(){//USART1 인터럽트
                    u8 c;
                    if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET)
                    {
                            c = USART1 -> DR;

                            switch(c){
                                    case 'S':
                                                            MS();
                                                            break;

                                    case 'B':
                                                            goA(1);




                                                         -  977  -
   979   980   981   982   983   984   985   986   987   988   989