⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 probe_rs232c.c

📁 NXPLPC2138 平台下使用UC/0S-II 操作系統. 在IAR工工程環境下的源代碼.帶有一此驅動程序,LCD驅動,還有原開發板的BSP包.
💻 C
📖 第 1 页 / 共 2 页
字号:
*
* Return(s)  : none.
*********************************************************************************************************
*/

void  ProbeRS232_RxTxISRHandler (void)
{
    volatile  CPU_INT08U  rx_data;
    volatile  CPU_INT08U  lsr;
    volatile  CPU_INT08U  iir;


#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_0)
    iir = U0IIR & 0x0F;
    while (iir != 1) {
        switch (iir) {
            case  2:                                            /* Transmitted character?                                   */
                 ProbeRS232_TxHandler();
                 break;

            case  4:                                            /* Received a character?                                    */
                 lsr     = U0LSR;
                 rx_data = U0RBR;
                 ProbeRS232_RxHandler(rx_data);                 /* Call the generic Rx handler                              */
                 break;

            default:
                 break;
        }
        iir = U0IIR & 0x0F;
    }
#endif

#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_1)
    iir = U1IIR & 0x0F;
    while (iir != 1) {
        switch (iir) {
            case  2:                                            /* Transmitted character?                                   */
                 ProbeRS232_TxHandler();
                 break;

            case  4:                                            /* Received a character?                                    */
                 lsr     = U1LSR;
                 rx_data = U1RBR;
                 ProbeRS232_RxHandler(rx_data);                 /* Call the generic Rx handler                              */
                 break;

            default:
                 break;
        }
        iir = U1IIR & 0x0F;
    }
#endif

    VICVectAddr = 0x00000000L;                                  /* Clear the vector address register                        */
}


/*
*********************************************************************************************************
*                                    ProbeRS232_RxISRHandler()
*
* Description: Handle Rx interrupts.
*
* Argument(s): none.
*
* Return(s)  : none.
*
* Note(s)    : This function is empty because Rx interrupts are handled by ProbeRS232_RxTxISRHandler()
*********************************************************************************************************
*/

void  ProbeRS232_RxISRHandler (void)
{
}


/*
*********************************************************************************************************
*                                      ProbeRS232_RxIntDis()
*
* Description: Disable Rx interrupts.
*
* Argument(s): none.
*
* Return(s)  : none.
*********************************************************************************************************
*/

void  ProbeRS232_RxIntDis (void)
{
#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_0)
    U0IER &= ~DEF_BIT_00;
#endif

#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_1)
    U1IER &= ~DEF_BIT_00;
#endif
}


/*
*********************************************************************************************************
*                                      ProbeRS232_RxIntEn()
*
* Description: Enable Rx interrupts.
*
* Argument(s): none.
*
* Return(s)  : none.
*********************************************************************************************************
*/

void  ProbeRS232_RxIntEn (void)
{
#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_0)
    U0IER |= DEF_BIT_00;
#endif

#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_1)
    U1IER |= DEF_BIT_00;
#endif
}


/*
*********************************************************************************************************
*                                    ProbeRS232_TxISRHandler()
*
* Description: Handle Tx interrupts.
*
* Argument(s): none.
*
* Return(s)  : none.
*
* Note(s)    : This function is empty because Tx interrupts are handled by ProbeRS232_RxTxISRHandler()
*********************************************************************************************************
*/

void  ProbeRS232_TxISRHandler (void)
{
}


/*
*********************************************************************************************************
*                                      ProbeRS232_Tx1()
*
* Description: Transmit one byte.
*
* Argument(s): c            The byte to transmit.
*
* Return(s)  : none.
*********************************************************************************************************
*/

void  ProbeRS232_Tx1 (CPU_INT08U c)
{
#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_0)
    U0THR = c;
#endif

#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_1)
    U1THR = c;
#endif
}


/*
*********************************************************************************************************
*                                      ProbeRS232_TxIntDis()
*
* Description: Disable Tx interrupts.
*
* Argument(s): none.
*
* Return(s)  : none.
*********************************************************************************************************
*/

void  ProbeRS232_TxIntDis (void)
{
#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_0)
    U0IER &= ~DEF_BIT_01;
#endif

#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_1)
    U1IER &= ~DEF_BIT_01;
#endif
}


/*
*********************************************************************************************************
*                                      ProbeRS232_TxIntEn()
*
* Description: Enable Tx interrupts.
*
* Argument(s): none.
*
* Return(s)  : none.
*********************************************************************************************************
*/

void  ProbeRS232_TxIntEn (void)
{
#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_0)
    U0IER |= DEF_BIT_01;
#endif

#if (PROBE_RS232_COMM_SEL == PROBE_RS232_UART_1)
    U1IER |= DEF_BIT_01;
#endif
}


⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -