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

📄 165lcd.lst

📁 51单片机控制LCD 按键 已经在Proteus下仿真通过
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V8.01   165LCD                                                                10/19/2006 11:02:45 PAGE 1   


C51 COMPILER V8.01, COMPILATION OF MODULE 165LCD
OBJECT MODULE PLACED IN 165LCD.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE 165LCD.c BROWSE INCDIR(C:\Keil\165LCD\;C:\Keil\165LCD\) DEBUG OBJECTEXTEND

line level    source

   1          /************************************************************
   2          ********** 任 意 波 形 的 单 片 机 控 制 部 分***************
   3          ********** 制作: 董文岳   单位:汕头大学  03 通信 **********
   4          ************************************************************/
   5          
   6          #include <reg51.h>
   7          #include <absacc.h>
   8          #include <intrins.h>
   9          #include"LCD1602.h"
  10          #include"jianpan.h"
  11          void keytask1();
  12          void keytask2();
  13          void keytask3();
  14          void task1();
  15          void task2();
  16          void task3();
  17          void task4();
  18          void pinmo();
  19          //void scankey();
  20          void IntToStr(unsigned char t, unsigned char *str, unsigned char n);
  21          void Delay1ms(unsigned int count);
  22          unsigned char TempBuffer[10]={0,1,2,3,4,5,6,7,8,9};
  23          sbit p1_0=P1^0;
  24          sbit p1_1=P1^1;
  25          sbit p1_2=P1^2;
  26          sbit p1_3=P1^3;
  27          sbit p1_4=P1^4;
  28          sbit p1_5=P1^5;
  29          sbit p1_6=P1^6;
  30          sbit p1_7=P1^7;
  31          sbit P2_7=P2^7;
  32          /************************************
  33          *****  定  义  外  部  变  量  ******
  34          ************************************/
  35          unsigned int zhengxian_flag=0;
  36          unsigned int fan_flag=0;
  37          unsigned int sanjiao_flag=0;
  38          unsigned int any_flag=0;//scankey_flag=0,keytask_flag=0;
  39          unsigned int t,n=0,m=0,b=0,p=0,f=0,x=0,count=0,key1,key2;//字的控制:p频率字,f幅度字,x相位字(显示用)
  40          /***********************************************************
  41          *******************     主  函  数     *********************
  42          ***********************************************************/
  43          void main()
  44          {do{
  45   2              pinmo();
  46   2              jian();
  47   2         }while(a[0]==1);
  48   1      
  49   1       p1_0=1;
  50   1       p1_5=0;
  51   1       p1_5=1;//164的初始化
  52   1      
  53   1       while(1)       
  54   1       {      jian();//键盘扫描
  55   2      
C51 COMPILER V8.01   165LCD                                                                10/19/2006 11:02:45 PAGE 2   

  56   2       }
  57   1      }/*
  58                  Delay1ms(700);
  59                  while(a[0]==0)//  p频率控制字的 输入控制        
  60                  {                       
  61                          jian(); //键盘扫描  
  62                          LCD_Initial();
  63                          GotoXY(14,1);
  64                          Print("Hz");
  65                          task1();
  66                  }
  67                  while(a[1]==0)//相位字
  68                  {       jian(); //键盘扫描
  69                          LCD_Initial();
  70                          GotoXY(7,1);
  71                          Print("C");
  72                          task2();
  73                  }
  74                  while(a[2]==0)
  75                  {       jian(); //键盘扫描
  76                  LCD_Initial();
  77                          GotoXY(14,0);
  78                          Print("mV");
  79                          task3();
  80                  }
  81                  task4();//波形选择
  82                  if(a[9]==0)//a[9]存了键值,按下就变为0
  83              {    
  84                          keytask1();
  85                  
  86                  }
  87                  if(a[10]==0)//a[9]存了键值,按下就变为0
  88              {    
  89                          keytask2();
  90                  
  91                  }
  92                  if(a[11]==0)//a[9]存了键值,按下就变为0
  93              {    
  94                          keytask3();
  95                  
  96                  }
  97           }
  98          }
  99          
 100          
 101          //频率字控制
 102          void task1()
 103          {               jian();
 104                          if((a[3]==0)&&(p<257))
 105                          {       IntToStr(p++,&TempBuffer[0],3);
 106                                  GotoXY(8,1);
 107                                  Print(&TempBuffer[0]);
 108                                  Delay1ms(700);
 109                          }
 110                          if((a[4]==0)&&(p<256))
 111                          {  
 112                                  IntToStr(p--,&TempBuffer[0],3);
 113                                  GotoXY(8,1);
 114                                  Print(&TempBuffer[0]);
 115                                  Delay1ms(700);
 116                          }
 117                          if(a[5]==0)
C51 COMPILER V8.01   165LCD                                                                10/19/2006 11:02:45 PAGE 3   

 118                          {       GotoXY(13,1);
 119                                  Print(" ");
 120                                  p=p;;
 121                          }
 122                          if(a[6]==0)
 123                          {       GotoXY(13,1);
 124                                  Print("K");
 125                                  p=p<<10;
 126                          }
 127                          if(a[7]==0)
 128                          {       GotoXY(13,1);
 129                                  Print("M");
 130                                  p=p<<20;
 131                          }
 132                          if(a[8]==0)
 133                          {  LCD_Write(LCD_COMMAND,LCD_CLEAR_SCREEN);//复位 频率字全部清零
 134                             p=0;p1_5=0;
 135                             Delay1ms(7000);
 136                          }n=p;
 137                          
 138          }
 139                  //相位字的控制
 140          void task2()
 141          {       
 142                          jian();
 143                          if((a[3]==0)&&(x<257))
 144                          {       IntToStr(x++,&TempBuffer[0],3);
 145                                  GotoXY(0,1);
 146                                  Print(&TempBuffer[0]);
 147                                  Delay1ms(700);
 148                          }
 149                          if((a[4]==0)&&(x<256))
 150                          {       IntToStr(x--,&TempBuffer[0],3);
 151                                  GotoXY(0,1);
 152                                  Print(&TempBuffer[0]);
 153                                  Delay1ms(700);
 154                          }
 155                          if(a[8]==0)
 156                          {  LCD_Write(LCD_COMMAND,LCD_CLEAR_SCREEN);//复位 相位字全部清零
 157                             Delay1ms(7000);p1_5=0;x=0;
 158                          }m=x;
 159          }
 160                   //幅度字的控制
 161          void task3()
 162          {       
 163                          jian(); //键盘扫描
 164                          if(a[5]==0)
 165                          {       GotoXY(15,0);
 166                                  Print("V");
 167                                  f=f<<10;
 168                          }
 169                          if((a[3]==0)&&(f<257))
 170                          {       IntToStr(f++,&TempBuffer[0],3);

⌨️ 快捷键说明

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