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

📄 uart_dv.lst

📁 mtv512mg + mx88v462 液晶电视驱动C完整程序
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.50   UART_DV                                                               12/14/2006 10:36:29 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE UART_DV
OBJECT MODULE PLACED IN .\UART_DV.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\source\UART_DV.C LARGE DEBUG OBJECTEXTEND PRINT(.\UART_DV.lst) OBJECT(.\
                    -UART_DV.obj)

line level    source

   1          /*-------------------------------------------------------------------------
   2          UART_DV.C
   3                  The UART service routine for debug.
   4                  
   5          Copyright 2004 Macronix International Co., Ltd.
   6          -------------------------------------------------------------------------*/
   7          #define _UART_DV_
   8          #include "..\inc\public2.h"
   9          
  10                  //============== UART Memory Define ================================
  11                  xdata BYTE      Rx_Buf[2][24]   _at_ 0x0880;
  12                  xdata BYTE      Tx_Buf[24]              _at_ 0x08B0;
  13                  xdata BYTE      ReTx_Buf[24]    _at_ 0x08C8;
  14               
  15                  xdata BYTE      UART_RxInUse=0;
  16                  xdata BYTE      Rx_Index = 0;
  17                  xdata BYTE      Tx_Index = 0;
  18                  xdata BYTE      Parse_Length = 0;
  19                  xdata BYTE      Tx_Length = 0;
  20                  xdata BYTE      ReTx_Length = 0;
  21               
  22                  xdata BYTE      *ExtMemPtr;
  23                  xdata BYTE      UARTFlag = 0;
  24          //      xdata BYTE      UART_Count = 0;
  25          
  26          extern BYTE             DEV_Inf[16];
  27          extern void             Read_OSDReg(BYTE *, BYTE, BYTE, BYTE);
  28          extern void             Write_OSDReg(BYTE *, BYTE, BYTE, BYTE); 
  29          extern BYTE             CVD1_ReadWrite(BYTE, BYTE, BYTE);
  30          
  31          /**--------------------------------------------------------------------------
  32          * Name          void UART1(void) interrupt 4 using 1
  33          *
  34          * Description   IRQ function,INT no.4 (Serial PORT) using BANK 1
  35          *                               When INT. set flagx,and clear RI/TI
  36          *
  37          * Return
  38          *
  39          * DATE          Author          Description
  40          * ===========================================================================
  41          * 2004/05/12    Eson W.                 Just test RI,OK!!
  42          *
  43          **/
  44          void UART1(void) interrupt 4 using 1
  45          {
  46   1      //      UART_Count++;
  47   1      //      if (UART_Count & 0x08)
  48   1      //              ;//LED_R ^= 1;
  49   1      
  50   1              if(RI==1)
  51   1              {
  52   2                      UART_RxByte();
  53   2                      RI=0;
  54   2              }
C51 COMPILER V7.50   UART_DV                                                               12/14/2006 10:36:29 PAGE 2   

  55   1      
  56   1              if(TI==1)
  57   1              {
  58   2                      UART_TxByte();
  59   2                      TI=0;
  60   2              }
  61   1              TF1=0;  // TF2
  62   1      }
  63          
  64          /**--------------------------------------------------------------------------
  65          * Name          void    UART_RxByte(void);
  66          *
  67          * Description   RX one byte from COM port.
  68          *
  69          * Flow Chart    P                       Read data from COM port
  70          *                               |
  71          *                               X---+           SYN1 flag set?
  72          *                               |       |
  73          *                               |       P               Yes, SYN1 set, Put Rx data to RX buf
  74          *                               |       |
  75          *                               |       X---+           End of Pack?
  76          *                               |       |       P                       Yes, set PARSE flag and reset SYN1 flag.
  77          *                               |       X                               No,  Check is Command length
  78          *                               |
  79          *                               X---+           NO, SYN1 not set, is SYN1 byte?
  80          *                                       |
  81          *                                       P                       Yes, is SYN1 byte put it to RX buffer
  82          *                                                               No,  ignore the  noise byte
  83          *
  84          * Return        None
  85          *
  86          * DATE          Author          Description
  87          * ===========================================================================
  88          * 2003-01-20    KM Ho                   This is first time implement
  89          * 2004-05-14    Eson W.                 Modify for 8051 component
  90          **/
  91          void    UART_RxByte()
  92          {
  93   1              BYTE    rx_data, i ;
  94   1              static  struct  UART_PACK       *rx_pack;
  95   1      
  96   1              rx_data = SBUF;                                                 //RX data from UART Buffer
  97   1      
  98   1              if (UARTFlag & RX_SYN1)                                 //check SYN1 flag is set
  99   1              {                                                                               //Next byte RX --- put to RX buf and check is EOP
 100   2      
 101   2                      Rx_Buf[UART_RxInUse][Rx_Index++]  = rx_data;
 102   2      
 103   2                      if ( Rx_Index >= UART_PACK_SIZE)                                //Is over Min. length?
 104   2                      {
 105   3                              if ( Rx_Index == UART_PACK_SIZE )
 106   3                              {
 107   4                                      rx_pack = (struct UART_PACK *)Rx_Buf[UART_RxInUse];
 108   4                                      Parse_Length = rx_pack->length + UART_PACK_SIZE;        //length of parse
 109   4                              }
 110   3                              
 111   3                              i = Rx_Index-Parse_Length;
 112   3                              
 113   3                              if ( i == 0 )                                                                   //End Of Pack
 114   3                              {
 115   4                                      UART_RxInUse ^= 1;                                                      //Ping-pong the buf index
 116   4      
C51 COMPILER V7.50   UART_DV                                                               12/14/2006 10:36:29 PAGE 3   

 117   4                                      UARTFlag |= RX_PARSE;                                           //Set flag
 118   4                                      UARTFlag &= (RX_SYN1 ^ CLEAN_UARTFlag);         //Clear RX_SYNC1 Flag
 119   4      
 120   4                              }
 121   3                              else if (Rx_Index >= 24)                                                //Is over Max. length?
 122   3                              {
 123   4                                      UARTFlag &= (RX_SYN1 ^ CLEAN_UARTFlag);
 124   4                              }
 125   3                      }
 126   2              }
 127   1              else
 128   1              {                                                                               //First byte RX --- is pack begin byte SYN1(0x66)?
 129   2                      Rx_Index  = 0;
 130   2      
 131   2                      if (rx_data == SYN_BYTE)
 132   2                      {
 133   3                              UARTFlag |= RX_SYN1;                    //set SYN1 flag
 134   3                              Rx_Buf[UART_RxInUse][Rx_Index++] = rx_data;
 135   3                      }                                                                       //ignore not pack begin byte
 136   2              }
 137   1      }
 138          
 139          /**--------------------------------------------------------------------------
 140          * Name          void    UART_TxByte(void);
 141          *
 142          * Description   TX one byte to UART, Sneding data only from Tx_Buf
 143          *
 144          * Flow Chart    X               Tx flag Set?
 145          *                               |
 146          *                               X---+   Is send complete
 147          *                               |       |
 148          *                               |       P               Yes, Send complete so clean TX flag
 149          *                               |                                and disable TX interrupt request, return
 150          *                               P                       No,  continue send put data to THR
 151          *
 152          * Return
 153          *
 154          * DATE          Author          Description
 155          * ===========================================================================
 156          * 2003-01-20    KM Ho                   This is first time implement
 157          * 2004-05-14    Eson W.                 Modify for 8051 component

⌨️ 快捷键说明

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