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

📄 testpromain.lst

📁 00ic-51开发板的预先烧写的程序
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.20   TESTPROMAIN                                                           11/17/2005 10:16:36 PAGE 1   


C51 COMPILER V7.20, COMPILATION OF MODULE TESTPROMAIN
OBJECT MODULE PLACED IN testpromain.OBJ
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE testpromain.c ROM(COMPACT) BROWSE DEBUG OBJECTEXTEND

line level    source

   1          /*----------------------------------www.00IC.com-----------------------------------------
   2                                ╔=======================================╗
   3                                ┆     00IC-51开发板配套实验学习例程     ┆
   4                                ┆             Version 2.0.1             ┆
   5                                ┆                                       ┆
   6                                ┆               零零电子                ┆
   7                                ┆                                       ┆
   8                                ┆          http://www.00IC.com          ┆
   9                                ┆         E-mail:sales@00IC.com         ┆
  10                                ╚=======================================╝
  11          ********************************** 程序功能说明 ******************************************************
  12                                  本程序用来检测00IC-51开发板程序运行及硬件功能是否正常的,具体现象请看说明书“上电检测”
  13          ******************************************************************************************************/
  14          
  15          #include "reg52.h"
  16          #include <intrins.h>
  17          
  18          //typedef bit BOOL  ;
  19          #define uchar unsigned char
  20          
  21          
  22          sbit D1=P2^0;
  23          sbit D2=P2^1;
  24          sbit D3=P2^2;
  25          sbit D4=P2^3;
  26          sbit CE573=P2^5;
  27          sbit BUZZER=P2^4;
  28          sbit KEY1=P3^3;
  29          sbit KEY2=P3^2;
  30          sbit KEY3=P3^4;
  31          sbit KEY4=P3^5;
  32          sbit KEY5=P3^7;
  33          
  34          
  35          #define SEL_D1 D1=0;
  36          #define SEL_D2 D2=0;
  37          #define SEL_D3 D3=0;
  38          #define SEL_D4 D4=0;
  39          
  40          #define REL_D1 D1=1;
  41          #define REL_D2 D2=1;
  42          #define REL_D3 D3=1;
  43          #define REL_D4 D4=1;
  44          
  45          
  46          sbit rs = P2^6 ; 
  47          sbit rw = P3^6 ;
  48          sbit ep = P2^7 ;
  49          
  50          
  51          
  52          void _delay(uchar) ;
  53          void lcd_wcmd(uchar) ;
  54          //BOOL lcd_bz() ;
  55          void lcd_pos(uchar) ;
C51 COMPILER V7.20   TESTPROMAIN                                                           11/17/2005 10:16:36 PAGE 2   

  56          void lcd_wdat(uchar) ;
  57          void display(uchar,uchar *) ;
  58          
  59          
  60          
  61          //串口、中断、初始化设置子函数
  62          //11.0592MH晶振下,波特率9600,无奇偶校验
  63          
  64          void initmpu(void) 
  65                             
  66          {
  67   1                      //定时器1的工作方式2
  68   1              TMOD=0x20;
  69   1                      //装载计数初值
  70   1              TL1=0xfd;
  71   1              TH1=0xfd;
  72   1                      //采用串口工作方式1,无奇偶校验
  73   1              SCON=0x50;      
  74   1                      //串口波特率不加倍
  75   1              PCON=0x00; 
  76   1                      //开总中断,开串口中断
  77   1              TR1=1;
  78   1              IE=0x95; 
  79   1      
  80   1      }
  81          
  82          void Delay(int m)
  83          {
  84   1              while(--m);
  85   1      }
  86          
  87          
  88          void test_led(void)
  89          {
  90   1              int i;
  91   1      
  92   1              P1=0x7F;
  93   1              Delay(40000);
  94   1              for(i=0;i<7;i++)
  95   1              {
  96   2                      P1=P1>>1;
  97   2                      Delay(40000);
  98   2              }
  99   1              P1=0xFF;
 100   1              return;
 101   1      
 102   1      }
 103          code unsigned char      digseg[]={              
 104                          0xC0,  // 0
 105                  0xF9,  // 1
 106                  0xA4,  // 2
 107                  0xB0,  // 3
 108                  0x99,  // 4
 109                  0x92,  // 5
 110                  0x82,  // 6
 111                  0xF8,  // 7
 112                  0x80,  // 8
 113                  0x90,  // 9
 114                          0x88,  // A
 115                  0x83,  // b
 116                  0xC6,  // C 
 117                  0xA1,  // d
C51 COMPILER V7.20   TESTPROMAIN                                                           11/17/2005 10:16:36 PAGE 3   

 118                  0x86,  // E
 119                  0x8E,  // F
 120                          };
 121          void test_digseg(void)
 122          {
 123   1              char i;
 124   1      
 125   1              CE573=1;        //0
 126   1              SEL_D1;
 127   1              SEL_D2;
 128   1              SEL_D3;
 129   1              SEL_D4;
 130   1              for(i=0;i<16;i++)
 131   1              {
 132   2                      P0=digseg[i];
 133   2                      Delay(40000);
 134   2              }
 135   1              P0=0xFF;
 136   1              Delay(50000);
 137   1              P0=0x00;
 138   1              Delay(50000);
 139   1              P0=0xFF;
 140   1              Delay(50000);
 141   1              P0=0x00;
 142   1              Delay(50000);
 143   1              P0=0xFF;
 144   1              
 145   1              /*
 146   1              P0=0x00;
 147   1              SEL_D1;
 148   1              Delay(60000);
 149   1              REL_D1;
 150   1              SEL_D2;
 151   1              Delay(60000);
 152   1              REL_D2;
 153   1              SEL_D3;
 154   1              Delay(60000);
 155   1              REL_D3;
 156   1              SEL_D4;
 157   1              Delay(60000);
 158   1              REL_D4;
 159   1              */
 160   1      
 161   1      }
 162          void test_beep(void)
 163          {
 164   1              BUZZER=0;
 165   1              Delay(60000);
 166   1              BUZZER=1;
 167   1              Delay(50000);
 168   1              BUZZER=0;
 169   1              Delay(60000);
 170   1              BUZZER=1;
 171   1      
 172   1      }
 173          
 174          char check_K3(void)
 175          {
 176   1              if(KEY3==0)
 177   1              {
 178   2                      Delay(2000);
 179   2                      {
C51 COMPILER V7.20   TESTPROMAIN                                                           11/17/2005 10:16:36 PAGE 4   

 180   3                              if(KEY3==0)
 181   3                              {
 182   4                                      return 1;       
 183   4                              }
 184   3                      }
 185   2              }
 186   1              return 0;       
 187   1      }
 188          char  check_K4(void)
 189          {
 190   1              if(KEY4==0)
 191   1              {
 192   2                      Delay(2000);
 193   2                      {
 194   3                              if(KEY4==0)
 195   3                              {
 196   4                                      return 1;       
 197   4                              }
 198   3                      }
 199   2              }
 200   1              return 0;       
 201   1      }
 202          char  check_K5(void)
 203          {
 204   1              if(KEY5==0)
 205   1              {
 206   2                      Delay(2000);
 207   2                      {
 208   3                              if(KEY5==0)
 209   3                              {
 210   4                                      return 1;       
 211   4                              }
 212   3                      }
 213   2              }
 214   1              return 0;       
 215   1      }
 216          
 217          code uchar  dis1[] = {"  www.00IC.com  "} ;
 218          code uchar  dis2[] = {"Hello 51MCUWorld"} ;
 219          
 220          code uchar send_txt[]= {"*************************************************************\n*                 
             -  Hardware Test OK!                       *\n*                  http://www.00ic.com                      *\n*      Now y
             -ou can use the 00IC-51MCU board for design!     *\n*************************************************************\n"};
 221          void test_serial()
 222          {
 223   1              int i;
 224   1              EA=0;
 225   1              for(i=0;i<sizeof(send_txt);i++)
 226   1              {
 227   2                      SBUF=send_txt[i];
 228   2                      while(TI==0);

⌨️ 快捷键说明

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