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

📄 uart_dv.lst

📁 MXIC旺宏液晶电视芯片MX88V44的源码
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.02b   UART_DV                                                              05/24/2006 17:59:20 PAGE 1   


C51 COMPILER V7.02b, 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 BROWSE DEBUG OBJECTEXTEND PRINT(.\UART_DV.lst) OB
                    -JECT(.\UART_DV.obj)

stmt 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          
   9          #include "..\inc\public2.h"
  10          #define         L44_WRID                        0x28            //define the 1574 I2C write ID
  11          #define         EEPROM_WRID                     0xA0            //EEPROM I2C Wirte ID
  12          
  13                  //============== UART Memory Define ================================
  14                  xdata char      Rx_Buf[2][24]   _at_ 0x0000;
  15                  xdata char      Tx_Buf[24]              _at_ 0x0030;
  16                  xdata char      ReTx_Buf[24]    _at_ 0x0050;
  17          
  18                  xdata char      UART_RxInUse    _at_ 0x0070;
  19                  xdata char      Rx_Index                _at_ 0x0072;
  20                  xdata char      Tx_Index                _at_ 0x0074;
  21                  xdata char      Data_Length             _at_ 0x0076;
  22                  xdata char      Parse_Length    _at_ 0x0078;
  23                  xdata char      Tx_Length               _at_ 0x007A;
  24                  xdata char      ReTx_Length             _at_ 0x007C;
  25          
  26                  xdata char      *ExtMemPtr              _at_ 0x0080;
  27                  xdata char      RW15xx_Addr             _at_ 0x0088;
  28                  xdata char      W15xx_Val               _at_ 0x008A;
  29                  xdata char      R15xx_Length    _at_ 0x008C;
  30          
  31                  xdata char      Tempbuf[64]             _at_ 0x00A0;
  32                  xdata char      WR_TestByte[16] _at_ 0x00E0;
  33          
  34                  char    UARTFlag;
  35                  char    UART_Count;
  36          
  37          extern char             DEV_Inf[16];
  38          
  39          extern void              Read_OSDReg(BYTE *, BYTE, BYTE, BYTE);
  40          extern void             Write_OSDReg(BYTE *, BYTE, BYTE, BYTE); 
  41          extern BYTE             CVD1_ReadWrite(BYTE, BYTE, BYTE);
  42          
  43          /**--------------------------------------------------------------------------
  44          * Name          void UART1(void) interrupt 4 using 1
  45          *
  46          * Description   IRQ function,INT no.4 (Serial PORT) using BANK 1
  47          *                               When INT. set flagx,and clear RI/TI
  48          *
  49          * Return
  50          *
  51          * DATE          Author          Description
  52          * ===========================================================================
  53          * 2004/05/12    Eson W.                 Just test RI,OK!!
  54          *
C51 COMPILER V7.02b   UART_DV                                                              05/24/2006 17:59:20 PAGE 2   

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

 117   3                              if (Rx_Index > 24)                              //Is over Max. length?
 118   3                              {
 119   4                                      UARTFlag &= (RX_SYN1 ^ CLEAN_UARTFlag);
 120   4                                      Rx_Index  = 0;
 121   4                                      Data_Length = 0;
 122   4                              }
 123   3      
 124   3                              if (Rx_Index == (Data_Length+UART_PACK_SIZE))   //End Of Pack
 125   3                              {
 126   4                                      Parse_Length = Data_Length+UART_PACK_SIZE;      //length of parse
 127   4                                      UART_RxInUse ^= 1;                      //Ping-pong the buf index
 128   4                                      Rx_Index = 0;
 129   4      
 130   4                                      UARTFlag |= RX_PARSE;           //Set flag, process in timer()
 131   4                                      IE |= 0x02;                                     //Enable Timer0;
 132   4                                                                                              //Before this,TIMER0 IRQ would be error!!
 133   4                                      UARTFlag &= (RX_SYN1 ^ CLEAN_UARTFlag);
 134   4                              }
 135   3                      }
 136   2              }
 137   1              else
 138   1              {               //First byte RX --- is pack begin byte SYN1(0x66)?
 139   2                      Rx_Index  = 0;
 140   2                      Data_Length = 0;
 141   2      
 142   2                      if (rx_data == SYN_BYTE)
 143   2                      {
 144   3                              UARTFlag |= RX_SYN1;                    //set SYN1 flag
 145   3                              Rx_Buf[UART_RxInUse][Rx_Index++] = rx_data;
 146   3                      }                                                                       //ignore not pack begin byte
 147   2              }
 148   1      }
 149          
 150          /**--------------------------------------------------------------------------
 151          * Name          void    UART_TxByte(void);
 152          *
 153          * Description   TX one byte to UART, Sneding data only from Tx_Buf
 154          *
 155          * Flow Chart    X               Tx flag Set?
 156          *                               |
 157          *                               X---+   Is send complete
 158          *                               |       |
 159          *                               |       P               Yes, Send complete so clean TX flag
 160          *                               |                                and disable TX interrupt request, return
 161          *                               P                       No,  continue send put data to THR
 162          *
 163          * Return
 164          *
 165          * DATE          Author          Description

⌨️ 快捷键说明

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