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

📄 nvram.lst

📁 TFT LCD驱动芯片T100A+AU7" Source code
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.06   NVRAM                                                                 06/16/2005 10:05:41 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE NVRAM
OBJECT MODULE PLACED IN F:\T100_C~1\HUI_CH~1\铁将军\SIMULA~2\NVRAM.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE F:\T100_C~1\HUI_CH~1\铁将军\SIMULA~2\NVRAM.C DB SB OE

stmt level    source

   1          #include <reg51.h>
   2          #include "common.h"
   3          #include "Struct.h"
   4          #include "system.h"
   5          #include "NVRam.h"
   6          #include "TW101Reg.h"
   7          #include "TwoWire.h"
   8          //#include "OSDCtrl.h"
   9          #include "KeyPad.h"
  10          //#include "ModeCtrl.h"
  11          //#include "ModeTbl.h"
  12          #include "Video.h"
  13          extern uCHAR cPAL_Dot,cNTSC_Dot,cSTV1_ON;
  14          extern void InitFactry(void);
  15          extern uCHAR cPAL_Dot,cNTSC_Dot;
  16          extern uCHAR cSTV1_ON;
  17          extern uCHAR cSTV_OFFSET;
  18          extern uCHAR cPAL_OFFSET,cNTSC_OFFSET,cGATE_PREDRIVE;
  19          
  20          #define PAGE0_NUM       0x70
  21          #define PAGE1_NUM       0x22
  22          #define PAGE2_NUM       0x26
  23          #define PAGE0_S         0x00
  24          #define PAGE1_S         PAGE0_NUM
  25          #define PAGE2_S         (PAGE1_S+PAGE1_NUM)
  26          #define PAGE2_E         (PAGE2_S+PAGE2_NUM)
  27          #define REG_ADDR_S      0x20
  28          uCHAR code RegisterMap[]={
  29          0x00,0x01,0x02,0x04,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0f,//12
  30          0x10,0x11,0x18,0x19,0x1a,0x1c,0x1d,0x1e,0x1f,//9
  31          0x30,0x31,0x32,0x33,0x35,0x36,0x37,0x38,0x3a,0x3b,0x3f,//11
  32          0x40,//1
  33          0x61,0x62,0x63,0x64,0x65,0x66,0x6a,0x6b,0x6c,//0x68,0x69,11-2=9
  34          0x70,0x72,0x73,0x74,0x75,0x76,0x77,0x7f,//8
  35          0x80,0x84,0x85,0x86,0x87,0x88,0x89,0x8a,0x8b,0x8c,0x8d,0x8e,0x8f,//13
  36          0x90,0x91,0x95,0x96,0x97,0x98,0x99,0x9a,0x9b,0x9c,0x9d,0x9e,0x9f,//13
  37          0xb0,0xb1,0xb2,0xb3,0xb4,0xb5,0xb6,0xb7,
  38          0xb8,0xb9,0xba,0xbb,0xbc,0xbd,0xbe,0xbf,//16
  39          0xc0,0xc1,0xc2,0xc3,0xc4,0xc7,0xc8,0xc9,0xca,//9
  40          0xd8,0xd9,0xda,0xdb,0xdc,0xdd,0xde,0xdf,//8
  41          0xe1,0xe8,0xe9,//0xe0,0xe3,//5-2=3------------------------112
  42          
  43          0x20,0x21,0x22,0x23,0x24,0x25,0x26,0x27,0x28,0x29,0x2a,0x2b,0x2d,//13
  44          0x30,0x31,0x32,0x33,0x34,0x35,//6
  45          0xd0,0xd1,0xd2,0xd3,0xd4,0xd5,0xd6,0xd7,
  46          0xd8,0xd9,0xda,0xdb,0xdc,0xde,0xdf,//15-------34
  47          
  48          0x00,0x01,0x02,0x03,0x04,0x05,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0f,//14
  49          0x10,0x11,0x16,0x17,0x18,0x19,0x1a,0x1b,0x1c,0x1d,0x1e,0x1f,//12
  50          0x20,0x2c,0x2d,0x2e,0x2f,//5
  51          0x30,0x31,0x39,0x3f,//4
  52          0x80,0x82,0x83//3-------------38-------------------------184
  53          
  54          };
  55          EEPVIDEO   idata EepVideo;      
C51 COMPILER V7.06   NVRAM                                                                 06/16/2005 10:05:41 PAGE 2   

  56          #ifdef NVRAM
  57          extern uWORD IDATA m_wBuff[3];
  58          extern uCHAR IDATA m_cBuff[4];
  59          extern void InitFactry(void);
  60          void EEPLoadPubData(void)
  61          {
  62   1              if(!(ReadPort()&kyMENU))
  63   1              {
  64   2                      InitEEPRom();
  65   2                      OSDResetVideoData();
  66   2                      while(!(ReadPort()&kyMENU))     {};
  67   2              }
  68   1              else
  69   1              {
  70   2                      if(I2CReadByte(0xA0, 0x00) != '1' || I2CReadByte(0xA0, 0x01)!= '0' || I2CReadByte(0xA0, 0x02)!= '0' )
  71   2                      {
  72   3                              InitEEPRom();
  73   3                              OSDResetVideoData();
  74   3                      }
  75   2                      else
  76   2                              I2CReadBytes(EEPVIDEOBLOCK, 0x04, (uCHAR *)&EepVideo, EEPVIDEOSIZE);
  77   2              }
  78   1              InitFactry();
  79   1              OSDSetVideoValues();
  80   1              I2CWriteByte(TW101, 0xE9, EepVideo.cVolume);
  81   1              EEPSaveVideoData();
  82   1      }
  83          //extern uCHAR cPAL_OFFSET,cNTSC_OFFSET;
  84          void InitEEPRom(void)
  85          {
  86   1              uCHAR i;
  87   1              I2CWriteByte(EEPBLOCK0, 0x00, '1');
  88   1              twdDelay(NVRDELAY);
  89   1              I2CWriteByte(EEPBLOCK0, 0x01, '0');
  90   1              twdDelay(NVRDELAY);
  91   1              I2CWriteByte(EEPBLOCK0, 0x02, '0');
  92   1              for(i=0x04;i<0xd8;i++)
  93   1              {
  94   2              twdDelay(NVRDELAY);
  95   2              I2CWriteByte(EEPBLOCK0, i, 0xff);
  96   2              }
  97   1              for(i=0xd8;i<0xff;i++)
  98   1              {
  99   2              twdDelay(NVRDELAY);
 100   2              I2CWriteByte(EEPBLOCK0, i, 0x00);
 101   2              }
 102   1              twdDelay(NVRDELAY);//*/
 103   1      }
 104          
 105          void OSDResetVideoData(void)
 106          {
 107   1              EepVideo.cBright        = V_BRIGHT_DEF;
 108   1              EepVideo.cContrast      = V_CONTRAST_DEF ;
 109   1              EepVideo.cSharp         = V_SHARP_DEF;
 110   1              EepVideo.cHue           = V_HUE_DEF;
 111   1              EepVideo.cSat           = V_SAT_DEF;
 112   1              EepVideo.cVolume        = 0x80;
 113   1      }
 114          
 115          void OSDSetVideoValues(void)
 116          {
 117   1      //      I2CWriteByte(VIDEO_ADDR,VSHARP,(I2CReadByte(VIDEO_ADDR,VSHARP)&0xF0)|EepVideo.cSharp);
C51 COMPILER V7.06   NVRAM                                                                 06/16/2005 10:05:41 PAGE 3   

 118   1      //      I2CWriteByte(VIDEO_ADDR,VBRIGHT,EepVideo.cBright);
 119   1      //      I2CWriteByte(VIDEO_ADDR,VCONTRAST,EepVideo.cContrast);
 120   1              I2CWriteByte(TW101,VBRIGHT,EepVideo.cBright);
 121   1              I2CWriteByte(TW101,VCONTRAST,EepVideo.cContrast);
 122   1              I2CWriteByte(VIDEO_ADDR,VSAT,EepVideo.cSat);
 123   1              I2CWriteByte(VIDEO_ADDR,VHUE,EepVideo.cHue-0x80);
 124   1      }
 125          
 126          void EEPSaveVideoData(void)
 127          {
 128   1              I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_CONTRAST_INDEX,EepVideo.cContrast );
 129   1              twdDelay(NVRDELAY);
 130   1              I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_BRIGHT_INDEX, EepVideo.cBright);
 131   1              twdDelay(NVRDELAY);
 132   1              I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_SHARP_INDEX, EepVideo.cSharp);
 133   1              twdDelay(NVRDELAY);
 134   1              I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_HUE_INDEX, EepVideo.cHue);
 135   1              twdDelay(NVRDELAY);
 136   1              I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_SAT_INDEX, EepVideo.cSat);
 137   1              twdDelay(NVRDELAY);
 138   1              I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_VOLUME_INDEX, EepVideo.cVolume);
 139   1              twdDelay(NVRDELAY);
 140   1              I2CWriteByte(EEPVIDEOBLOCK, idVIDEO_FLAG_INDEX, EepVideo.cFlag);
 141   1              twdDelay(NVRDELAY);
 142   1              I2CWriteByte(0xa0, 0x10, cPAL_Dot);//PAL
 143   1              twdDelay(NVRDELAY);
 144   1              I2CWriteByte(0xa0, 0x11, cNTSC_Dot);//NTSC
 145   1      }
 146          void ReadFactryData(void)
 147          {
 148   1              twdDelay(NVRDELAY);
 149   1              cPAL_Dot        =I2CReadByte(0xa0, 0x10);//PAL
 150   1              twdDelay(NVRDELAY);
 151   1              cNTSC_Dot       =I2CReadByte(0xa0, 0x11);//NTSC
 152   1              twdDelay(NVRDELAY);
 153   1              cSTV1_ON        =I2CReadByte(0xa0, 0x12);
 154   1              twdDelay(NVRDELAY);
 155   1              cSTV_OFFSET     =I2CReadByte(0xa0, 0x13);
 156   1              twdDelay(NVRDELAY);
 157   1              cPAL_OFFSET     =I2CReadByte(0xa0, 0x14);
 158   1              twdDelay(NVRDELAY);
 159   1              cNTSC_OFFSET=I2CReadByte(0xa0, 0x15);
 160   1              twdDelay(NVRDELAY);
 161   1              cGATE_PREDRIVE          =I2CReadByte(0xa0, 0x16);
 162   1              twdDelay(NVRDELAY);
 163   1      }
 164          #ifdef TV
              extern bit m_bAir_Cable;
              void EEPSaveTVChannel(uCHAR cTVNum, uWORD wTVFreq)
              {
                      if(m_bAir_Cable)
                      {
                      I2CWriteByte(EEPVIDEOBLOCK, idTVCHANNEL_STAT+cTVNum*2, (uCHAR)(wTVFreq>>8));
                      twdDelay(NVRDELAY);
                      I2CWriteByte(EEPVIDEOBLOCK, idTVCHANNEL_STAT+cTVNum*2+1, (uCHAR)(wTVFreq&0x00FF));
                      twdDelay(NVRDELAY);
                      }
                      else
                      {
                      I2CWriteByte(EEPVIDEOBLOCK+2, idTVCHANNEL_STAT+cTVNum*2, (uCHAR)(wTVFreq>>8));
                      twdDelay(NVRDELAY);
                      I2CWriteByte(EEPVIDEOBLOCK+2, idTVCHANNEL_STAT+cTVNum*2+1, (uCHAR)(wTVFreq&0x00FF));
C51 COMPILER V7.06   NVRAM                                                                 06/16/2005 10:05:41 PAGE 4   

                      twdDelay(NVRDELAY);
                      }
              }
              

⌨️ 快捷键说明

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