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

void USART2Write(u8* data,u16 len)
             {
                     u16 i;
             //      DIR485_H ;
                     for (i=0; i<len-1; i++){
                             USART2_SendByte(data[i]);
                     }
             //      Delay10us(1000);
             //      DIR485_L;
             }


             void USART1_Configuration(void)
             {
                     USART_InitTypeDef USART_InitStructure;
                     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_HardwareFlowControl                                        =
             USART_HardwareFlowControl_None;
                     USART_InitStructure.USART_Mode                = USART_Mode_Rx | USART_Mode_Tx;
                     USART_Init(USART1, &USART_InitStructure);
                     USART_ITConfig(USART1, USART_IT_RXNE, ENABLE); //enable
                     USART_Cmd(USART1, ENABLE);
                                                      //USART1설정

                 NVIC_EnableIRQ(USART1_IRQn);//USART1 인터럽트  인에이블
             }


              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);



                                                         -  261  -
   263   264   265   266   267   268   269   270   271   272   273