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

📄 sys_uart_debug.c

📁 其乐达(Cheertek)LCD驱动芯片(CT675)的C51源代码
💻 C
字号:
#include "INC\SYS_DECLARE.H"

#if(UART_DEBUG_MSG)

#include "INC\SYS_GLOBAL.H"

#define UART_BIT(x)     { UART_TX_PIN = x;    Delay17uS(); }

BYTE bdata gbBitByte;

sbit gfBbit7 = gbBitByte ^ 7 ;
sbit gfBbit6 = gbBitByte ^ 6 ;
sbit gfBbit5 = gbBitByte ^ 5 ;
sbit gfBbit4 = gbBitByte ^ 4 ;
sbit gfBbit3 = gbBitByte ^ 3 ;
sbit gfBbit2 = gbBitByte ^ 2 ;
sbit gfBbit1 = gbBitByte ^ 1 ;
sbit gfBbit0 = gbBitByte ^ 0 ;

void Delay17uS(void)    // 57600 bps
{
    BYTE i;

    for(i = 0; i < 8; i++);
    _nop_();
    _nop_();
}

void UartOut(BYTE bDt)
{
    gbBitByte = bDt;
    EA = 0;
    UART_BIT(0);            // Start
    UART_BIT(gfBbit0);
    UART_BIT(gfBbit1);
    UART_BIT(gfBbit2);
    UART_BIT(gfBbit3);
    UART_BIT(gfBbit4);
    UART_BIT(gfBbit5);
    UART_BIT(gfBbit6);
    UART_BIT(gfBbit7);
    UART_BIT(1);            // Stop
    EA = 1;
    UART_BIT(1);            // Stop
}

//--------------------------------------------------------------------------
//  For printf function
//      %[flag][width][.precision][{b|B|l|L}]type
//
//      type :
//          d   int             Signed decimal number
//          u   unsigned int    Unsigned decimal number
//          X   unsigned int    Unsigned hexadecimal number using "0123456789ABCDEF"
//          c   char            Single character
//          s   generic*        String with a terminating null character
//          p   generic*        pointer using the format t.aaaa
//                              t-->Memory type i:data/idata, x:xdata, p:pdata
//                              aaaa-->Hexadecimal address
//
//          x   unsigned int    Unsigned hexadecimal number using "0123456789abcdef"
//          o   unsigned int    Unsigned octal number
//          f   float           FloatingPoint number using the formation [-]dddd.dddd
//          e   float           FloatingPoint number using the formation [-]d.dddde[-]dd
//          E   float           FloatingPoint number using the formation [-]d.ddddE[-]dd
//--------------------------------------------------------------------------
void putchar(BYTE bDt)
{
    if(bDt == 0x0A) UartOut(0x0D);
    UartOut(bDt);
}

#endif // UART_DEBUG_MSG

⌨️ 快捷键说明

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