uart.c

来自「Dignostic test program for SMDK441f boar」· C语言 代码 · 共 44 行

C
44
字号
#include "def.h"
#include "option.h"
#include <string.h>
#include "k44.h"
#include "k44lib.h"

static char *uartTxStr;



void __irq IsrUartTx(void)
{
    rINTPEND=~BIT_UTXD;
    //rI_ISPC; //is needed only when cache=on & wrbuf=on & BSFRD=0

    if(*uartTxStr != '\0')
        rTBR=(*uartTxStr++);
    else
        rINTMASK&=~BIT_UTXD;
}



void Test_Uart(void)
{
         
    pISR_UTXD=(unsigned)IsrUartTx;

    Uart_Printf("[Uart tx interrupt test]\n");

    Uart_TxEmpty(); //wait until tx shifter is empty.

    uartTxStr="UART0 Tx interrupt test is good!!!!\r\n";

    //
    //may need triggering character!!!
    //
    rINTMASK=BIT_UTXD;
    
    Delay(3000);
    rINTMASK=0;
}

⌨️ 快捷键说明

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