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

GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AF_PP;

                    GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
                    GPIO_Init(GPIOA, &GPIO_InitStructure);
                    /*USART*/
            }



            /*USART1 으로  NDSocket을  사용하기위한  함수들*/
            void USART1_Configuration(){//USART설정
                    USART_InitTypeDef USART_InitStructure;


                    /*Enable USARTx clock*/

                    //RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1,Enable);


                    USART_InitStructure.USART_BaudRate = 115200;
                    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);
            }


            /*USART1 인터럽트  NDSocket에서  값이  수신이  되었을  때  여기  루틴에  들어온다.*/
            void USART1_IRQHandler(){

                    u8 c;
                    if(USART_GetITStatus(USART1, USART_IT_RXNE) != RESET){
                            GPIO_SetBits(GPIOC,GPIO_Pin_1);
                            c = USART1 -> DR;

                            switch(c){
                                    case '1'://1사분면  으로  이동




                                                         -  967  -
   969   970   971   972   973   974   975   976   977   978   979