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

📄 signal_show.lst

📁 简易示波器 (采样点在屏上显示虚线曲线)
💻 LST
📖 第 1 页 / 共 3 页
字号:
C51 COMPILER V7.06   SIGNAL_SHOW                                                           03/26/2007 17:35:00 PAGE 1   


C51 COMPILER V7.06, COMPILATION OF MODULE SIGNAL_SHOW
OBJECT MODULE PLACED IN signal_show.OBJ
COMPILER INVOKED BY: D:\Program Files\Keil\C51\BIN\C51.EXE signal_show.c BROWSE DEBUG OBJECTEXTEND

stmt level    source

   1          //波形显示在第一层,网格坐标显示在第二层,汉字菜单显示在第三层.
   2          #include <reg51.h>
   3          #include <absacc.h>
   4          #include <math.h>
   5          #include "constant.h"
   6          #include "iCf.h"
   7          #include "rCf.h"
   8          #include "ziku.h"
   9          #include "f_define.h"//函数定义
  10          //输入频率92Hz
  11          /***************************************************************
  12          *名称:outcode(uchar code_data)
  13          *描述:向液晶屏输出指令代码
  14          *参数:指令代码
  15          *返回:
  16          ****************************************************************/
  17          void outcode(uchar code_data)//输出指令代码
  18          {
  19   1      //      lcd_cs=0;
  20   1      //      lcd_a0=1;
  21   1      //      lcd_rd=1;
  22   1      //      lcd_wr=1;
  23   1              P0=code_data;
  24   1              lcd_wr=0;
  25   1              lcd_wr=1;
  26   1      //      lcd_cs=1;
  27   1      }
  28          /***************************************************************
  29          *名称:outdata(uchar data_data)
  30          *描述:向液晶屏输出指令参数
  31          *参数:指令参数
  32          *返回:
  33          ****************************************************************/
  34          void outdata(uchar data_data)//输出指令参数
  35          {
  36   1      //      lcd_cs=0;
  37   1      //      lcd_a0=0;
  38   1      //      lcd_rd=1;
  39   1      //      lcd_wr=1;
  40   1              P0=data_data;
  41   1              lcd_wr=0;
  42   1              lcd_wr=1;
  43   1      //      lcd_cs=1;
  44   1      }
  45          /***************************************************************
  46          *名称:uchar indata(void)
  47          *描述:从液晶屏输入数据
  48          *参数:
  49          *返回:输入数据
  50          ****************************************************************/
  51          uchar indata(void)//输入数据
  52          {
  53   1              uchar idata data_data;
  54   1      //      Ram_cs = 1 ;
  55   1      //      lcd_cs=0;
C51 COMPILER V7.06   SIGNAL_SHOW                                                           03/26/2007 17:35:00 PAGE 2   

  56   1      //      lcd_a0=1;
  57   1              P0=0xff;
  58   1      //      lcd_wr=1;
  59   1              lcd_rd=0;
  60   1              data_data=P0;
  61   1              lcd_rd=1;
  62   1      //      lcd_cs=1;
  63   1              return data_data;
  64   1      }
  65          /***************************************************************
  66          *名称:turnoff(void)
  67          *描述:关闭液晶屏
  68          *参数:
  69          *返回:
  70          ****************************************************************/
  71          void turnoff(void)
  72          {
  73   1              lcd_a0=1;
  74   1              outcode(0x58);//off screen
  75   1              lcd_a0=0;
  76   1              outdata(0x00);
  77   1      }
  78          /***************************************************************
  79          *名称:turnon(void)
  80          *描述:开启液晶屏
  81          *参数:
  82          *返回:
  83          ****************************************************************/
  84          void turnon(void)
  85          {
  86   1              lcd_a0=1;
  87   1              outcode(0x59);//on screen
  88   1              lcd_a0=0;
  89   1              outdata(0x55);
  90   1      }
  91          /***************************************************************
  92          *名称:initram(void)
  93          *描述:清屏(3层)
  94          *参数:
  95          *返回:
  96          ****************************************************************/
  97          void initram(void)
  98          {//显示存储器清零
  99   1              unsigned int idata i;
 100   1              lcd_a0=1;
 101   1              outcode(0x4c);
 102   1              outcode(0x46);
 103   1              lcd_a0=0;
 104   1              outdata(0x00);
 105   1              outdata(0x00);
 106   1              lcd_a0=1;
 107   1              outcode(0x42);//clear screen memory
 108   1              lcd_a0=0;
 109   1              for(i=0;i<0x7800;)
 110   1              {
 111   2                      outdata(0x00);
 112   2                      i++;
 113   2              }
 114   1      }
 115          /***************************************************************
 116          *名称:initram(void)
 117          *描述:清屏(2层)
C51 COMPILER V7.06   SIGNAL_SHOW                                                           03/26/2007 17:35:00 PAGE 3   

 118          *参数:
 119          *返回:
 120          ****************************************************************/
 121          void initram_2(void)
 122          {//显示存储器清零
 123   1              unsigned int idata i;
 124   1              lcd_cs=0;
 125   1              lcd_a0=1;
 126   1              outcode(0x4c);
 127   1              outcode(0x46);
 128   1              lcd_a0=0;
 129   1              outdata(0x00);
 130   1              outdata(0x28);
 131   1              lcd_a0=1;
 132   1              outcode(0x42);//clear screen memory
 133   1              lcd_a0=0;
 134   1              for(i=0;i<0x2800;)
 135   1              {
 136   2                      outdata(0x00);
 137   2                      i++;
 138   2              }
 139   1              lcd_cs=1;
 140   1      }
 141          /***************************************************************
 142          *名称:init(void)
 143          *描述:初始化程序
 144          *参数:
 145          *返回:
 146          ****************************************************************/
 147          void init(void)
 148          {
 149   1              int idata n;
 150   1              lcd_a0=1;
 151   1              outcode(0x40); /*SYSTEM SET 指令代码*/
 152   1              lcd_a0=0;
 153   1              for(n=0;n<8;n++)outdata(sys[n]); /*将参数P1-P8 写入*/
 154   1              lcd_a0=1;
 155   1              outcode(0x44); /*SCROLL 指令代码*/
 156   1              lcd_a0=0;
 157   1              for(n=0;n<10;n++)outdata(scr[n]); /*将参数P1-P10 写入*/
 158   1              lcd_a0=1;
 159   1              outcode(0x5a); /*HDOT SCR——P1 清零复位*/
 160   1              lcd_a0=0;
 161   1              outdata(0);
 162   1              lcd_a0=1;
 163   1              outcode(0x5b); /*OVLAY—*/
 164   1              lcd_a0=0;
 165   1              outdata(0x1c);
 166   1      }
 167          /***************************************************************
 168          *名称:WriteD(uchar x,uchar y)
 169          *描述:在第一层写一个点
 170          *参数:点的坐标位置(x,y)
 171          *返回:
 172          ****************************************************************/
 173          void WriteD(uchar x,uchar y)  //write a dot on the 1nd layer
 174          {
 175   1              unsigned int idata address;
 176   1              uchar idata addh,addl;
 177   1              uchar idata m=0,n;
 178   1              address=0x01f9+x/8+y*AP;
 179   1              addh=address>>8;//addh=address/256;
C51 COMPILER V7.06   SIGNAL_SHOW                                                           03/26/2007 17:35:00 PAGE 4   

 180   1              addl=(uchar)address;//addl=address%256;
 181   1              n=x%8;
 182   1              lcd_cs=0;
 183   1              lcd_a0=1;
 184   1              outcode(0x46);
 185   1              lcd_a0=0;
 186   1              outdata(addl);
 187   1              outdata(addh);
 188   1              lcd_a0=1;
 189   1              outcode(0x43);
 190   1              m=indata();
 191   1              m=m|arr[n];
 192   1              outcode(0x46);
 193   1              lcd_a0=0;
 194   1              outdata(addl);
 195   1              outdata(addh);
 196   1              lcd_a0=1;
 197   1              outcode(0x42);
 198   1              lcd_a0=0;
 199   1              outdata(m);
 200   1              lcd_cs=1;
 201   1      }
 202          /***************************************************************
 203          *名称:WriteD2(uchar x,uchar y)
 204          *描述:在第二层写一个点
 205          *参数:点的坐标位置(x,y)
 206          *返回:
 207          ****************************************************************/
 208          void WriteD2(uchar x,uchar y)  //write a dot on the 2nd layer
 209          {
 210   1              unsigned int idata address;
 211   1              uchar idata addh,addl;
 212   1              uchar idata m=0,n=0;
 213   1              address=0x29f9+x/8+y*AP;
 214   1              addh=address>>8;//addh=address/256;
 215   1              addl=(uchar)address;//addl=address%256;
 216   1              lcd_cs=0;
 217   1              lcd_a0=1;
 218   1              outcode(0x46);
 219   1              lcd_a0=0;
 220   1              outdata(addl);
 221   1              outdata(addh);
 222   1              lcd_a0=1;
 223   1              outcode(0x43);
 224   1              m=indata();
 225   1              n=x%8;
 226   1              m=m|arr[n];
 227   1              outcode(0x46);
 228   1              lcd_a0=0;
 229   1              outdata(addl);
 230   1              outdata(addh);
 231   1              lcd_a0=1;
 232   1              outcode(0x42);
 233   1              lcd_a0=0;
 234   1              outdata(m);//m
 235   1              lcd_cs=1;
 236   1      }
 237          /***************************************************************
 238          *名称:Hori(uchar y,uchar space)
 239          *描述:在第二层画水平网格线
 240          *参数:网格的行数、空的点数
 241          *返回:
C51 COMPILER V7.06   SIGNAL_SHOW                                                           03/26/2007 17:35:00 PAGE 5   

 242          ****************************************************************/
 243          void Hori(uchar y,uchar space)       //画水平网格线
 244          {
 245   1                uchar i;
 246   1                lcd_cs=0;
 247   1                lcd_a0=1;
 248   1                outcode(0x4c);
 249   1                lcd_cs=1;
 250   1                for(i=space;i<LENGTH;i+=space)WriteD2(i,y);
 251   1      }
 252          /***************************************************************
 253          *名称:Ver(uchar x,uchar space)
 254          *描述:在第二层画垂直网格线
 255          *参数:网格的列数、空的点数
 256          *返回:
 257          ****************************************************************/
 258          void Ver(uchar x,uchar space)        //画垂直网格线
 259          {
 260   1                uchar idata i=0 ;
 261   1                lcd_cs=0;
 262   1                lcd_a0=1;
 263   1                outcode(0x4f);
 264   1                lcd_cs=1;
 265   1      
 266   1                if((x==0)|(x==0xfa))i=0;
 267   1                else  i=space;
 268   1      
 269   1                for(;i<WIDTH;i+=space)WriteD2(x,i);
 270   1      }
 271          /***************************************************************
 272          *名称:fixline(uchar y)
 273          *描述:在第二层画横线
 274          *参数:横线的行数
 275          *返回:
 276          ****************************************************************/
 277          void fixline(uchar y)
 278          {
 279   1              unsigned int idata address;
 280   1              uchar idata addh,addl;
 281   1          uchar idata i;
 282   1              address=0x2a18+y*AP;
 283   1              addh=address>>8;//addh=address/256;
 284   1              addl=(uchar)address;//addl=address%256;
 285   1              lcd_cs=0;
 286   1              lcd_a0=1;
 287   1              outcode(0x46);
 288   1              lcd_a0=0;
 289   1              outdata(addl);
 290   1              outdata(addh);
 291   1              lcd_a0=1;
 292   1              outcode(0x4c);
 293   1              outcode(0x42);
 294   1              lcd_a0=0;
 295   1              outdata(0x3f);
 296   1              for(i=1;i<8;i++)outdata(0xff);
 297   1              lcd_cs=1;
 298   1      }
 299          /***************************************************************
 300          *名称:fixline2(uchar y)
 301          *描述:在第二层右半边画横线
 302          *参数:横线的行数
 303          *返回:
C51 COMPILER V7.06   SIGNAL_SHOW                                                           03/26/2007 17:35:00 PAGE 6   

 304          ****************************************************************/
 305          void fixline2(uchar y)
 306          {
 307   1              unsigned int idata address;
 308   1              uchar idata addh,addl;
 309   1          uchar idata i;
 310   1              address=0x29f9+y*AP;
 311   1              addh=address>>8;//addh=address/256;
 312   1              addl=(uchar)address;//addl=address%256;
 313   1              lcd_cs=0;
 314   1              lcd_a0=1;
 315   1              outcode(0x46);
 316   1              lcd_a0=0;
 317   1              outdata(addl);
 318   1              outdata(addh);
 319   1              lcd_a0=1;

⌨️ 快捷键说明

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