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

📄 status.lst

📁 一个用于驱动TFT屏的驱动程序,使用IC:1828,program (无EEPROM 无IR,完整说明)IIC只写一个
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.50   STATUS                                                                09/29/2006 10:54:52 PAGE 1   


C51 COMPILER V7.50, COMPILATION OF MODULE STATUS
OBJECT MODULE PLACED IN status.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE status.c BROWSE DEBUG OBJECTEXTEND CODE

line level    source

   1          //*********************************************************************
   2          //               status.c     1828 的状态程序文件
   3          //               by hibernate  2005.11.7   
   4          //       ShenZhen Challenge Technology Co.,Ltd
   5          //remarks:本文件对1828的状态寄存器进行设置.
   6          // 这个文件中主要包含有程序的制式,通道,和信号有无的判断
   7          //********************************************************************* 
   8          #include "IIC_RW.h"
   9          #include "vxis1828.h"
  10          #include "timer.h"
  11          #include "config.h"
  12          
  13          // 制式的状态处理函数
  14          unsigned char get1828Format();
  15          unsigned char getCurrentFormat();
  16          void setCurrentFormat(unsigned char format);
  17          
  18          // 通道的状态处理函数 
  19          void set1828Ch(unsigned char ch_index);
  20          void change1828Ch(unsigned char ch_index); 
  21          unsigned char getCurrentCh();
  22          void setCurrentCh(unsigned char ch_index);
  23          unsigned char getChIndex(unsigned char value);
  24          unsigned char getChValue(unsigned char index);
  25          
  26          // 信号状态的处理函数
  27          bit signelInput();
  28          
  29          unsigned char getLength(unsigned char * array);         // 用于计算数组的长度
  30          
  31          unsigned char current_format;                                           // Video format (mcu中记录的制式值)
  32                                                                                                                  // 0:PAL-N 1:PAL 2:PAL-M  3:NTSC
  33          unsigned char current_ch_index;
  34          
  35          //****************************************************
  36          //函数: unsigned char get1828Format()
  37          //作用: 获取当前的制式
  38          //参数:
  39          //****************************************************
  40          unsigned char get1828Format()                                                                   //
  41          {
  42   1              unsigned char format;
  43   1      
  44   1              format = read1828(0xD3);                                                                        //通过读取D3寄存器获得当前制式
  45   1              format >>= 2;
  46   1              format = format & 0x03;
  47   1      
  48   1              return format;
  49   1      }
  50          
  51          //****************************************************
  52          //函数: unsigned char getCurrentFormat()
  53          //作用: 获取MCU中记录的制式
  54          //参数:
  55          //****************************************************
C51 COMPILER V7.50   STATUS                                                                09/29/2006 10:54:52 PAGE 2   

  56          unsigned char getCurrentFormat()
  57          {
  58   1              return current_format;
  59   1      }
  60          
  61          //****************************************************
  62          //函数: void setCurrentFormat(unsigned char format)
  63          //作用: 更改MCU中记录的制式
  64          //参数:
  65          //****************************************************
  66          void setCurrentFormat(unsigned char format)
  67          {
  68   1              current_format = format;
  69   1      }
  70          
  71          //***********************************************
  72          //函数:void set1828Ch(unsigned char ch_index)
  73          //作用:选择analog video input
  74          //参数: aisel    => 8 bits , Analog video input selection (低4位有效)
  75          //remark:函数通过读取init1828_data[]对1828进行初始化
  76          //              aisel 是1828DataSheet中的叫法
  77          //************************************************
  78          void set1828Ch(unsigned char ch_index)
  79          {
  80   1              unsigned char tmp;
  81   1      
  82   1              tmp = getChValue(ch_index);
  83   1              tmp = tmp & 0x0F;
  84   1              write1828(0x02,tmp);                                                                    // AISEL
  85   1              DelayXms(0xc8);
  86   1      }
  87          
  88          //****************************************************
  89          //函数:  getSignel_Channell()
  90          //作用: 获取当前有信号有通道
  91          //参数:
  92          //****************************************************
  93          void change1828Ch(unsigned char ch_index)
  94          {
  95   1              write1828(0x06,0x2A);
  96   1              
  97   1              set1828Ch(ch_index);                                    
  98   1              DelayXms(0x30);
  99   1      
 100   1              write1828(0x06,0x6A);
 101   1      }
 102          
 103          //****************************************************
 104          //函数: unsigned char getCurrentCh()
 105          //作用: 获取MCU中记录的通道
 106          //参数:
 107          //****************************************************
 108          unsigned char getCurrentCh()
 109          {
 110   1              return current_ch_index;
 111   1      }
 112          
 113          //****************************************************
 114          //函数:  void setCurrentCh(unsigned char ch_index)
 115          //作用: 更改MCU中记录的通道
 116          //参数:
 117          //****************************************************
C51 COMPILER V7.50   STATUS                                                                09/29/2006 10:54:52 PAGE 3   

 118          void setCurrentCh(unsigned char ch_index)
 119          {
 120   1              current_ch_index = ch_index;
 121   1      }
 122          
 123          //****************************************************
 124          //函数:  signelInput()
 125          //作用: 判断有没有信号输入,有就返回1,没有返回0
 126          //remarks:通过判断状态寄存器得到
 127          //****************************************************
 128          bit signelInput()
 129          {
 130   1              char temp;
 131   1      
 132   1              temp = read1828(0xD5);
 133   1              temp = temp & 0x01;                                                                              // 只用最后一位进行判断
 134   1      
 135   1              return temp;
 136   1                      
 137   1      }
 138          
 139          //***********************************************
 140          //函数:unsigned char getChIndex(unsigned char ch_value)
 141          //作用: 根据通道的数值返回通道的序号
 142          //参数说明:
 143          //remarks: 通道的数值就是在调试程序的过程中得到的数值,
 144          //************************************************
 145          unsigned char getChIndex(unsigned char ch_value)
 146          {
 147   1              unsigned char  ch_index = 0x01;                                                         // 这个数值是程序中使用的通道的序号值
 148   1      
 149   1              switch(ch_value)
 150   1              {
 151   2                      case 0x86:
 152   2                              ch_index = 1;
 153   2                              break;
 154   2                      case 0x82:
 155   2                              ch_index = 2;
 156   2                              break;
 157   2                      case 0x8A:
 158   2                              ch_index = 3;
 159   2                              break;
 160   2                      default:break;
 161   2              }
 162   1      
 163   1              return ch_index;
 164   1      }
 165          
 166          //***********************************************
 167          //函数:unsigned char getChValue(unsigned char ch_index)
 168          //作用: 根据通道的序号返回通道的数值
 169          //参数说明:
 170          //remarks: 通道的数值就是在调试程序的过程中得到的数值,
 171          //        在程序中需要修改
 172          //************************************************
 173          unsigned char getChValue(unsigned char ch_index)
 174          {
 175   1              unsigned char  ch_value;                                                                        // 这个数值是1828的regsiter 中选择通道的值
 176   1      
 177   1              if(ch_index == 0x01)
 178   1                      ch_value = 0x86;
 179   1              else if(ch_index == 0x02)
C51 COMPILER V7.50   STATUS                                                                09/29/2006 10:54:52 PAGE 4   

 180   1                      ch_value = 0x82;
 181   1              else if(ch_index == 0x03)
 182   1                      ch_value = 0x8A;        
 183   1      
 184   1              return ch_value;
 185   1      }
 186          //***********************************************
 187          //函数:unsigned char getLength(unsigned char * array)
 188          //作用: 计算出数组array的长度(大小)
 189          //参数说明:     array   => 数组 ,使用两个EOT(0xFF)表示结束
 190          //remarks: 
 191          //************************************************
 192          unsigned char getLength(unsigned char * array)
 193          {
 194   1              unsigned char count;
 195   1      
 196   1              for(count = 0; ;)
 197   1              {
 198   2                      if(array[count] == EOT && array[count+1] == EOT)
 199   2                              return count;
 200   2                      count += 0x02 ;
 201   2              }
 202   1              return 0;
 203   1      }
 204          
 205          
C51 COMPILER V7.50   STATUS                                                                09/29/2006 10:54:52 PAGE 5   

ASSEMBLY LISTING OF GENERATED OBJECT CODE


             ; FUNCTION get1828Format (BEGIN)
                                           ; SOURCE LINE # 40
                                           ; SOURCE LINE # 41
                                           ; SOURCE LINE # 44
0000 7FD3              MOV     R7,#0D3H
0002 120000      E     LCALL   _read1828
;---- Variable 'format' assigned to Register 'R7' ----
                                           ; SOURCE LINE # 45
0005 EF                MOV     A,R7
0006 13                RRC     A

⌨️ 快捷键说明

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