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

📄 iccontrol.lst

📁 T103的开发程序 能兼容很多屏 可根据需要修改定义
💻 LST
字号:
C51 COMPILER V8.08   ICCONTROL                                                             11/23/2007 00:57:17 PAGE 1   


C51 COMPILER V8.08, COMPILATION OF MODULE ICCONTROL
OBJECT MODULE PLACED IN .\Object\ICControl.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE SourceFile\ICControl.C LARGE BROWSE INCDIR(.\IncludeFile;.\IncludeFile\Pane
                    -l;.\IncludeFile\Font_Icon) DEFINE(T108) DEBUG OBJECTEXTEND PRINT(.\List\ICControl.lst) OBJECT(.\Object\ICControl.obj)

line level    source

   1          /*##########################################################################
   2          #                      Terawins Inc. Company                               #
   3          #                 Copyright (c) 2005, All rights reserved                  #
   4          #                                                                          #
   5          #  All rights reserved. Reproduction in whole or in parts is prohibited    #
   6          #  without the prior written consent.                                      #
   7          ##########################################################################*/
   8             
   9          ///////////////////////////////////////////////////////////////////////////////
  10          //                                                                            //
  11          //                          LCD Application Firmware                          //
  12          // ========================================================================== //
  13          //                                                                            //
  14          //  Module   : ICControl                                                      //
  15          //                                                                            //
  16          //  Purpose  : IC control functions                                                   //
  17          //                                                                            //
  18          //  Version  : 1.00                                                           //
  19          //                                                                            //
  20          //  Compiler : Keil 8051 C Compiler v7.5                                      //
  21          //                                                                            //
  22          //  Reference: [1] Keil C51 Compiler User's Guide 09.2001, Keil Software, Inc.//
  23          //                                                                            //
  24          // ========================================================================== //
  25          //                                                                            //
  26          //  Date        Author        Reason (what and why)                           //
  27          //  ----------- ------------- ----------------------------------------------  //
  28          //  2005/12/30  Kevin Hsu                                                                     //
  29          //                                                                            //
  30          ////////////////////////////////////////////////////////////////////////////////
  31          #include "Common.h"
  32          #include "Global.h"
  33          #include "ICControl.h"
  34          #include "TWICreg.h"
  35          #include "OSD1_Define.h"
  36          #include "OSD2_Define.h"
  37          #include "I2c.h"
  38          #include "Myson8957.h"
  39          #define BASEADDRESS 0x0000
  40          
  41                            
  42          void IC_WritByte(uWORD bPage, uCHAR bAdd, uCHAR bData)
  43          {
  44   1          /* start condition */
  45   1          StartCondition();
  46   1          bPage &= 0xFE;   // Force WRITE address
  47   1          /* send device ID and write data */
  48   1          if(!Send_Byte(bPage))
  49   1          {
  50   2              if(!Send_Byte(bAdd))
  51   2              {
  52   3                  if(!Send_Byte(bData))
  53   3                  {
  54   4                      StopCondition();
C51 COMPILER V8.08   ICCONTROL                                                             11/23/2007 00:57:17 PAGE 2   

  55   4                      //return(0);      /* success */
  56   4                  }
  57   3              }
  58   2          }
  59   1          StopCondition();
  60   1          //return(1);                
  61   1      
  62   1      }
  63          
  64          uCHAR IC_ReadByte(uWORD bPage, uCHAR bAdd)
  65          {
  66   1          uCHAR cResult = 0;          
  67   1      
  68   1          /* write reg offset */
  69   1          StartCondition();
  70   1          if(Send_Byte(bPage))
  71   1              return 0;  // Write address
  72   1          if(Send_Byte(bAdd))
  73   1              return 0;
  74   1      
  75   1          /* read data */
  76   1          StartCondition();
  77   1          if (Send_Byte(bPage | 0x01)) // Read address
  78   1              return 0;
  79   1          cResult = Read_Byte(1);
  80   1      
  81   1          StopCondition();
  82   1          return cResult;
  83   1      }
  84          
  85          void twdDelay(uWORD wLoops)
  86          {
  87   1              uWORD wTemp;  
  88   1          while (wLoops--) {
  89   2                  wTemp = 20; // one loop below takes about 11 us
  90   2              while (wTemp--)
  91   2                      {
  92   3                              wTemp=wTemp;
  93   3                      }
  94   2          }
  95   1      
  96   1      }
  97          
  98          /*   C L O S E   P A N E L   */
  99          /*-------------------------------------------------------------------------
 100             ignore and block the input vsync triggering the output vsync ,
 101             display user define color in panel
 102          -------------------------------------------------------------------------*/
 103          void ClosePanel(uCHAR uR, uCHAR uG, uCHAR uB)
 104          {
 105   1              //IC_WritByte(TWIC_P1, 0xB8, IC_ReadByte(TWIC_P1,0xB8)&0x7F);
 106   1      
 107   1              IC_WritByte(TWIC_P0, 0xC2, IC_ReadByte(TWIC_P0, 0xC2)|(PSYNC_STR|IGNORE_VSYNC));
 108   1              IC_WritByte(TWIC_P0, 0x9d, uR);
 109   1              IC_WritByte(TWIC_P0, 0x9e, uG);
 110   1              IC_WritByte(TWIC_P0, 0x9f, uB);
 111   1              IC_WritByte(TWIC_P0, PATTERN_CTRL, 0x87);//enable frame background color 
 112   1              IC_WritByte(TWIC_P0, 0xe2, 0x11);   //enable registers shadow control,sync all shadow registers
 113   1              m_bPanelClose=1;
 114   1              
 115   1      }
 116          
C51 COMPILER V8.08   ICCONTROL                                                             11/23/2007 00:57:17 PAGE 3   

 117          void OpenPanel(void)
 118          {       
 119   1                         
 120   1              IC_WritByte(TWIC_P0, 0xC2, IC_ReadByte(TWIC_P0, 0xC2)&~(PSYNC_STR|IGNORE_VSYNC));
 121   1              //IC_WritByte(TWIC_P1, 0xB8, IC_ReadByte(TWIC_P1,0xB8)|0x80);
 122   1              IC_WritByte(TWIC_P0, PATTERN_CTRL, IC_ReadByte(TWIC_P0, PATTERN_CTRL)&~0x80); //Enable Frame Background C
             -olor
 123   1              IC_WritByte(TWIC_P0, 0xe2, 0x11);   //enable registers shadow control,sync all shadow registers
 124   1              m_bPanelClose=0;
 125   1      
 126   1      }
 127          //~ OSD1 Config Register Setting ~//
 128          void OSD1CfgWr(uCHAR index,uCHAR dat)
 129          {
 130   1              IC_WritByte(TWIC_P0,OSD1_CFG_INDEX,index);
 131   1              IC_WritByte(TWIC_P0,OSD1_CFG_DATA,dat);
 132   1      }
 133          //~ OSD1 Target OSD Ram Setting.  ~//
 134          void OSD1SetRamAddr(uWORD address)
 135          {
 136   1              
 137   1              IC_WritByte(TWIC_P0,OSD1_RAM_AL,(uCHAR)(address & 0xff));  
 138   1              IC_WritByte(TWIC_P0,OSD1_RAM_AH,(uCHAR)(address>>8));
 139   1      }
 140          void OSD1SetRamData(uWORD wdata)
 141          {
 142   1              IC_WritByte(TWIC_P0,OSD_RAM_DL,(uCHAR)(wdata & 0xff));
 143   1              IC_WritByte(TWIC_P0,OSD_RAM_DH,(uCHAR)(wdata>>8));
 144   1      } 
 145          
 146          
 147          // OSD2 config register Write
 148          void OSD2CfgWr(uCHAR index,uCHAR dat)
 149          {
 150   1              IC_WritByte(TWIC_P0,OSD2_CFG_INDEX,index);
 151   1              IC_WritByte(TWIC_P0,OSD2_CFG_DATA,dat);
 152   1      }
 153          //~ OSD2 Target OSD Ram Setting.  ~//
 154          void OSD2SetRamAddr(uWORD address)
 155          {
 156   1              IC_WritByte(TWIC_P0,OSD2_RAM_AL,(uCHAR)(address & 0xff));
 157   1              IC_WritByte(TWIC_P0,OSD2_RAM_AH,(uCHAR)(address>>8));
 158   1      
 159   1      }
 160          void OSD2SetRamData(uWORD wdata)
 161          {
 162   1              IC_WritByte(TWIC_P0,OSD2_RAM_DL,(uCHAR)(wdata & 0xff));         
 163   1              IC_WritByte(TWIC_P0,OSD2_RAM_DH,(uCHAR)(wdata>>8));
 164   1              
 165   1      }
 166                                    
 167          //--------------------------------------------------
 168          // 041901, Added for TWD Burst Write
 169          // 1. PT8655X_Wr_Burst_A    (Start + Slave_ID + Address)
 170          // 2. PT8655X_Wr_Burst_D    (Data)
 171          // 3. PT8655X_Wr_Burst_P    (stop)
 172          //--------------------------------------------------
 173          uCHAR ICWr_Burst_A(uCHAR cReg)
 174          {
 175   1          StartCondition();
 176   1          if(!Send_Byte(TWIC_P0))
 177   1          {
C51 COMPILER V8.08   ICCONTROL                                                             11/23/2007 00:57:17 PAGE 4   

 178   2              if(!Send_Byte(cReg))
 179   2              {
 180   3                  return(0);               
 181   3              }
 182   2          }
 183   1          return(1);                  
 184   1      }
 185          
 186          
 187          void ICWr_Burst_D(uCHAR cData)
 188          {
 189   1          uCHAR ix;
 190   1      
 191   1          for(ix = 0; ix < 8; ix++)
 192   1          {
 193   2              Set_SCL2Low;
 194   2              if(cData&0x80)Set_SDA2High;
 195   2                      else Set_SDA2Low;
 196   2                      cData<<=1;
 197   2              Set_SCL2High;
 198   2          }
 199   1          Set_SCL2Low;
 200   1          Set_SDA2High;                /* release data line for acknowledge */
 201   1          Set_SCL2High;                /* Send a clock for Acknowledge */
 202   1          Set_SCL2Low;                   /* Finish Acknoledge */
 203   1      }
 204          
 205          
 206          void ICWr_Burst_P(void)
 207          {
 208   1          StopCondition();
 209   1      }
 210          void OSDSetRamDataBuest(uWORD wdata)
 211          {
 212   1              ICWr_Burst_D((uCHAR)(wdata & 0xff));
 213   1              ICWr_Burst_D((uCHAR)(wdata>>8));                        
 214   1      }
 215          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    537    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----      22
   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 + -