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

NVIC_EnableIRQ(USART1_IRQn);
             }


              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(USART1, USART_IT_RXNE) !=RESET)
                     {
                             usart1=USART1_ReceiveData();
                             if(usart1=='a')
                         //라즈베리  파이가  ‘#’을  수신받았을  때  ‘a’를  송신할  수  있도록  만들었다.
                             {
                                     if(pay!=0)
                                     {
                                             usart_last_cursor--;


             if(usart_tag[usart_last_cursor][3]=='B'||usart_tag[usart_last_cursor][4]=='B')
                                                     {pay-=5000;}
                                             else
             if(usart_tag[usart_last_cursor][3]=='5'||usart_tag[usart_last_cursor][4]=='5')
                                                     {pay-=2000;}
                                             else
             if(usart_tag[usart_last_cursor][3]=='D'||usart_tag[usart_last_cursor][4]=='D')
                                                     {pay-=3000;}



                                                         -  305  -
   307   308   309   310   311   312   313   314   315   316   317