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

📄 1574main.lst

📁 small pannel driver using MXIC s 88LV462,this sample code including the function IIC with 8051,IR,OS
💻 LST
字号:
C51 COMPILER V7.01  1574MAIN                                                               07/14/2005 15:18:37 PAGE 1   


C51 COMPILER V7.01, COMPILATION OF MODULE 1574MAIN
OBJECT MODULE PLACED IN .\1574Main.obj
COMPILER INVOKED BY: d:\Keil\C51\BIN\C51.EXE ..\source\1574Main.c LARGE DEBUG OBJECTEXTEND PRINT(.\1574Main.lst) OBJECT(
                    -.\1574Main.obj)

stmt level    source

   1          #include "..\inc\public2.h"
   2          #include        <string.h>
   3          #define RX_PARSE        0x80            //pack data ready, wait process Parse routine
   4          
   5          #define ENTER           0x1E            //pressed key then pull low
   6          #define UP                      0x1B
   7          #define DOWN            0x17
   8          #define MENU            0x0F
   9          
  10          #define WR_CVD1_BYTE            14
  11          #define L44_WRID                        0x28
  12          #define SEL_OSDDISPCODE         0x02
  13          
  14          extern code unsigned char CVD1_NTSCTab[WR_CVD1_BYTE*2];
  15          extern code unsigned char CVD1_PALMTab[WR_CVD1_BYTE*2];
  16          extern code unsigned char CVD1_PALTab[WR_CVD1_BYTE*2];
  17          extern code unsigned char CVD1_SECAMTab[WR_CVD1_BYTE*2];
  18          
  19          extern BYTE             CVD1_ReadWrite(BYTE, BYTE, BYTE);
  20          extern xdata BYTE       CBSH_Value[8];
  21          
  22          extern void             Adj_CBSH(void);
  23          extern void             All_Init(void);
  24          extern void             OSD_ShowTitle(char *, char);
  25          extern void             Write_OSDReg(BYTE [], BYTE, BYTE, BYTE);
  26          extern void             Adj_DisplayMode(char);
  27          
  28          extern int              T0_0Interval;
  29          extern BYTE         T0_0Service;                //Timer 0 service Var.
  30          
  31                  //---   Function Prototype Define       ----------------
  32          BYTE            WaitKey(void);
  33          
  34          BYTE    NTSC_PAL;
  35          //===========================================================================
  36          //===========================================================================
  37          void main(void)
  38          {
  39   1              BYTE    key, dig_cvd, i, show_type;
  40   1              BYTE    cdv_3Astatus, cdv_3Cstatus, set_times;
  41   1              BYTE    ch_type[14], dig_str[14];
  42   1      
  43   1              All_Init();             //Init. all of IC Reg. and Variable
  44   1                                              //      There are include 8051, 15xx and TV-Decoder
  45   1      
  46   1              strcpy(ch_type,   "VIDEO 1 NTSC ");
  47   1      //      strcpy(dig_str,   "DIGITAL      ");
  48   1              
  49   1              NTSC_PAL = 0;   //default NTSC mode
  50   1              dig_cvd = 1;    //flag for switch CCIR or CVD1 CH#1, 2, 3
  51   1              set_times = 0;
  52   1              show_type = 0;
  53   1              
  54   1              OSD_ShowTitle(ch_type, 13);
C51 COMPILER V7.01  1574MAIN                                                               07/14/2005 15:18:37 PAGE 2   

  55   1              while(1)
  56   1              {
  57   2                      cdv_3Astatus = CVD1_ReadWrite(0x00, 0x3A, 0x00) & 0x0E; // read CVD1 status: chroma PLL/V/H line lock 
  58   2                      cdv_3Cstatus = CVD1_ReadWrite(0x00, 0x3C, 0x00) & 0x04; // 625 scan line detected
  59   2                                      
  60   2                      //Check is Composite input CH# and CDV signal is not LOCK
  61   2                      if (dig_cvd && cdv_3Astatus!=0x0E)              
  62   2                      {
  63   3                              NTSC_PAL = cdv_3Cstatus;
  64   3                              if (!show_type)
  65   3                              {
  66   4                                      OSD_ShowTitle(ch_type, 13);
  67   4                                      show_type = 1;
  68   4                              }                               
  69   3                              I2C_WriteByte(L44_WRID, 0x20,  0xC0);   //Turn OFF Screen
  70   3      
  71   3                              if (cdv_3Cstatus) // PAL system input           
  72   3                              {                                               
  73   4                                      if (set_times++ < 3)    
  74   4                                      {
  75   5                                              for (i=0; i<WR_CVD1_BYTE; i++)
  76   5                                                      CVD1_ReadWrite(0x01, CVD1_SECAMTab[i*2], CVD1_SECAMTab[i*2+1]);
  77   5                                              strcpy(&ch_type[8], "SECAM");
  78   5                                      }
  79   4                                      else
  80   4                                      {                                               
  81   5                                              for (i=0; i<WR_CVD1_BYTE; i++)  // set reg for PAL input
  82   5                                                      CVD1_ReadWrite(0x01, CVD1_PALTab[i*2], CVD1_PALTab[i*2+1]);
  83   5                                              strcpy(&ch_type[8], "PAL  ");                                   
  84   5                                      }
  85   4                                                                              
  86   4                                      if (CBSH_Value[6])              //Turn ON the Edge filter
  87   4                                              CVD1_ReadWrite(0x01, 0x01, 0x08);
  88   4      
  89   4                                      I2C_WriteByte(L44_WRID, 0x71, 0xA3);
  90   4                                      I2C_WriteByte(L44_WRID, 0x68, 0x74);
  91   4                                      set_times &= 0x07;
  92   4                              }
  93   3                              else   // NTSC system input
  94   3                              {       
  95   4                                      I2C_WriteByte(L44_WRID, 0x71, 0x09);            
  96   4                                      if (set_times++ < 3)
  97   4                                      {
  98   5                                              for (i=0; i<WR_CVD1_BYTE; i++)
  99   5                                                      CVD1_ReadWrite(0x01, CVD1_NTSCTab[i*2], CVD1_NTSCTab[i*2+1]);
 100   5                                              strcpy(&ch_type[8], "NTSC ");
 101   5                                      }
 102   4                                      else
 103   4                                      {                                       //PAL M mode
 104   5                                              for (i=0; i<WR_CVD1_BYTE; i++)
 105   5                                                      CVD1_ReadWrite(0x01, CVD1_PALMTab[i*2], CVD1_PALMTab[i*2+1]);
 106   5                                              strcpy(&ch_type[8], "PAL M");
 107   5                                      }
 108   4                                      if (CBSH_Value[6])                                              //Turn ON the Edge filter
 109   4                                              CVD1_ReadWrite(0x01, 0x01, 0x09);
 110   4                      
 111   4                                      set_times &= 0x07;
 112   4                              }                       
 113   3                              Adj_DisplayMode(CBSH_Value[7]);
 114   3                      }
 115   2                      else
 116   2                      {
C51 COMPILER V7.01  1574MAIN                                                               07/14/2005 15:18:37 PAGE 3   

 117   3                              if (show_type)
 118   3                              {
 119   4                                      I2C_WriteByte(L44_WRID, 0x20,  0x40);   //Turn ON  Screen               //***
 120   4                                      if (dig_cvd)
 121   4                                              OSD_ShowTitle(ch_type, 13);
 122   4                                      show_type = 0;
 123   4                              }
 124   3                      }
 125   2      
 126   2                      key = WaitKey();
 127   2      
 128   2                      if (key == ENTER)                       //Switch Input CH# CCIR / Composite 1,2,3
 129   2                      {
 130   3                              if (++dig_cvd > 3)      dig_cvd = 0;
 131   3                              Adj_DisplayMode(CBSH_Value[7]);
 132   3                              if (dig_cvd)
 133   3                              {
 134   4                                      if (dig_cvd == 1)       CVD1_ReadWrite(0x01, 0x90, 0x00);       //CH#1
 135   4                                      if (dig_cvd == 2)       CVD1_ReadWrite(0x01, 0x90, 0x40);       //CH#2
 136   4                                      if (dig_cvd == 3)       CVD1_ReadWrite(0x01, 0x90, 0x80);       //CH#3
 137   4      
 138   4                                      I2C_WriteByte(L44_WRID, 0x00, 0x41);    //Switch to CVD1
 139   4                                      ch_type[5] = dig_cvd | 0x30;
 140   4                                      OSD_ShowTitle(ch_type, 13);     
 141   4                              }
 142   3                              else
 143   3                              {
 144   4                                      NTSC_PAL = 0x00;
 145   4                                      I2C_WriteByte(L44_WRID, 0x68, 0x10);
 146   4      
 147   4                                      I2C_WriteByte(L44_WRID, 0x00, 0x78);    //Switch to CCIR 601
 148   4                                      OSD_ShowTitle(dig_str, 13);
 149   4                              }
 150   3                      }
 151   2      
 152   2                      if (key == MENU)
 153   2                              Adj_CBSH();
 154   2              }
 155   1      }
 156          
 157          /**--------------------------------------------------------------------------
 158          * Name          BYTE    WaitKey()
 159          *
 160          * Description   There are 2 working item in this function
 161          *                               1. Detect the UART Flag for RS-232 parse process
 162          *
 163          *                               2. Detect and return whick key press and release
 164          *                                       Press key               Return code             8051 Port
 165          *                               ----------------------------------------------
 166          *                                       Enter                   0x1E                    P0.0
 167          *                                       DOWN                    0x1B                    P0.2
 168          *                                       UP                              0x17                    P0.3
 169          *                                       MENU                    0x0F                    P0.4
 170          *
 171          *                                       Not press               0x00
 172          *
 173          * Flow Chart
 174          *
 175          * Return                press_key
 176          *
 177          * DATE          Author          Description
 178          * ===========================================================================
C51 COMPILER V7.01  1574MAIN                                                               07/14/2005 15:18:37 PAGE 4   

 179          * 2004-07-10    K.M. Ho         This is first time implement
 180          */
 181          BYTE    WaitKey(void)
 182          {
 183   1              BYTE    press_key;
 184   1      
 185   1              press_key = P0 & 0x1F;                          // get press key from Port#0
 186   1      
 187   1                      //***************************************
 188   1                      //---   Process the UART service        -----
 189   1                      //***************************************
 190   1              if (UARTFlag & RX_PARSE)                        //service the parse
 191   1                      UART_ParseFun();                                //Jump into UART_ParseFun() function
 192   1      
 193   1                      //***********************************
 194   1                      //---   Process The 15xx Key    -----
 195   1                      //***********************************
 196   1      
 197   1              if (press_key != 0x1F)
 198   1              {
 199   2                      for (;;)                                                //wait all key release
 200   2                              if ((P0&0x1F)==0x1F)
 201   2                                      break;
 202   2      
 203   2                      T0_0Interval = 500;                             //reset the Timer interval 10sec.
 204   2      //P2 ^= ~(press_key|0xE0);
 205   2              }
 206   1              else
 207   1                      press_key = 0;
 208   1      
 209   1              return (press_key);                                     //if not press key will return 0x00
 210   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    792    ----
   CONSTANT SIZE    =     38    ----
   XDATA SIZE       =      1      36
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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