註冊 登錄
Android 台灣中文網 返回首頁

wenhao61的個人空間 https://www.apk.tw/?929518 [收藏] [複製] [分享] [RSS]

日誌

[M3] UART Interrupt Backdoor.... IRQ

已有 388 次閱讀2017-9-28 15:34 |個人分類:CM3| Interrupt

void USART1_IRQHandler(void) 
{
uint8_t ch=0;

    if( USART_GetIntBitState(USART1, USART_INT_RBNE) != RESET)
    {
        /* Read one byte from the receive data register */
        //RxBuffer[ RxCounter++ ] = ( uint8_t )USART_DataReceive( USART1 );
ch = ( uint8_t )USART_DataReceive( USART1 );
USART_DataSend( USART1 , ch );
RxBuffer[ RxCounter++ ]=ch;
if(ch==0x0a || ch==0x0d){
//USART_DataSend( USART1 , " " );
uart_cmd=1;
USART_INT_Set( USART1 , USART_INT_RBNE , DISABLE );
}
        //if( RxCounter >= NbrOfDataToRead )
        //{
            /* Disable the USARTy Receive interrupt */
        //    USART_INT_Set( USART1 , USART_INT_RBNE , DISABLE );
        //}

    }

#if 0
    if( USART_GetIntBitState( USART1, USART_INT_TBE ) != RESET )
    {   
        /* Write one byte to the transmit data register */
        USART_DataSend( USART1 , TxBuffer[ TxCounter ++ ] );

        if( TxCounter >= NbrOfDataToSend )
        {
            /* Disable the USART1 Transmit interrupt */
            USART_INT_Set(USART1, USART_INT_TBE, DISABLE);      
        }
    }
#endif
}


路過

雞蛋

鮮花

握手

雷人

全部作者的其他最新日誌

評論 (0 個評論)

facelist

您需要登錄後才可以評論 登錄 | 註冊