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

📄 main.lst

📁 本程序实现通过BDM方式访问MOTOROLA 9S12单片机EEPROM
💻 LST
字号:
C51 COMPILER V7.50   MAIN                                                                  07/16/2008 08:39:35 PAGE 1   


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

line level    source

   1          /****************************************Copyright (c)**************************************************
   2          **                                    大连双马电子有限公司
   3          **                                       研   发   部
   4          **                                         研发一部 
   5          **
   6          **                                 http://www.smelecom.com/
   7          **
   8          ** 文   件   名: Motorola MCU 11series programme for unencrypt read、write and erase
   9          ** 编 写  日 期: 2006年7月17日
  10          ** 描        述: This programme is used for read and write the Motorola 11series MCU
  11          ** 版        本: the first one 
  12          ** 编        者: 宋晓伟
  13          **********************************************************************************************************
             -*/
  14          #include <reg54.h>
  15          //#include <stdio.h>
  16          //#include <absacc.h>
  17          //#include <intrins.h>
  18          #include <series sub.h>
  19          #include <delay subroutine.h>
  20          //#include <tr and re subroutine.h>
  21          
  22          
  23          #define uchar unsigned char
  24          #define uint unsigned int
  25          
  26          sbit CTRLDIR =   P3^3;
  27          sbit CTRL    =   P3^4;
  28          
  29          sbit RST=P1^7;
  30          sbit BDM=P1^4;
  31          
  32          sbit relaycs = P1 ^ 6;  
  33          sbit relaydin = P1 ^ 0;
  34          sbit relaysck = P1 ^ 1;
  35          uchar Instruction[5]; 
  36          
  37          
  38          void J_Config(int config_value)
  39          {
  40   1              uint m;
  41   1          m=0;
  42   1      
  43   1      //      P4 &= ~(1<<0);                  //控制J9
  44   1              delay100ms();delay100ms();
  45   1              relaysck = 0;
  46   1              relaycs = 0;
  47   1      
  48   1          while(m<16)
  49   1              {
  50   2                      if(config_value & 1)
  51   2                        {
  52   3                relaydin=1;
  53   3                }
  54   2                      else 
C51 COMPILER V7.50   MAIN                                                                  07/16/2008 08:39:35 PAGE 2   

  55   2                        {
  56   3                relaydin=0;
  57   3                }
  58   2                  relaysck=1;
  59   2                 
  60   2                      relaysck=0;
  61   2              
  62   2                  m=m+1;
  63   2                      config_value = config_value >> 1;
  64   2         
  65   2              }
  66   1              relaycs=1;                              //锁存
  67   1              delay100ms();delay100ms(); 
  68   1              P4 &= ~(1<<0);
  69   1      //      P4 |= (1<<0);
  70   1          delay100ms();delay100ms();
  71   1              
  72   1      }
  73          void operation()
  74          {
  75   1              P4 &= ~(1<<2);
  76   1              CTRL=0;
  77   1              delay1ms();
  78   1              CTRLDIR=0;
  79   1              delay40ms();
  80   1              switch(Instruction[0])
  81   1              {
  82   2              case 0x88:Read_datas();;break;
  83   2                      case 0x99:Write_datas();break;
  84   2              case 0x77:Erase_datas();break;
  85   2              default:output(0x00);break;
  86   2              }    
  87   1          delay40ms();
  88   1              P4 |= (1 << 2);                                 //置灭绿灯 
  89   1              P4 &= ~(1 << 1);
  90   1              delay200ms();
  91   1              P4 |= (1 << 1);                                         //蜂鸣器 
  92   1      }  
  93          
  94          void In_instruction()
  95          {
  96   1          int k1;
  97   1          for(k1=0;k1<5;k1++) 
  98   1               {
  99   2           Instruction[k1]=input();   
 100   2           }
 101   1      }
 102          
 103          uchar Pin_detect() 
 104          {
 105   1          uchar result=0;
 106   1      
 107   1              if(BDM==1)
 108   1                      result|=0x40;
 109   1              if(RST==1)
 110   1                      result|=0x01; 
 111   1          return(result);
 112   1      }
 113          
 114          void main()
 115          {
 116   1              uchar pin_result;                               //define the pin value//
C51 COMPILER V7.50   MAIN                                                                  07/16/2008 08:39:35 PAGE 3   

 117   1              uchar pin_result_fail;
 118   1              delay100ms();
 119   1              output(0x55);
 120   1              delay4ms();
 121   1              
 122   1      
 123   1      //      EA=1;
 124   1      //    ET1=1;
 125   1          while(1)
 126   1              {       
 127   2                      P4 |= (1 << 2);                                 //置灭绿灯      
 128   2                      CTRL=1;
 129   2                      delay1ms();
 130   2                      CTRLDIR=1;                             
 131   2                      In_instruction();
 132   2      
 133   2                      J_Config(0x300c);               //配置所有主机继电器
 134   2      
 135   2                      P4 |= (1 << 3);                         //重新开始关闭报错灯     
 136   2      
 137   2                      pin_result=(Pin_detect());              //get the pin value//
 138   2      
 139   2                      pin_result_fail=pin_result;
 140   2      
 141   2                      pin_result|=0xbe;                               
 142   2                      if(pin_result==0xff)                    //0xff,correct,or return the fault number//
 143   2                              {
 144   3                              output(0x55);
 145   3                              output(pin_result);
 146   3                  operation();
 147   3                      }
 148   2                      else
 149   2                              {
 150   3                              output(0xaa);
 151   3                              output(pin_result_fail); 
 152   3                              P4 &= ~(1 << 3);                                        //报错点亮红灯+
 153   3                              P4 &= ~(1 << 1);
 154   3                              delay200ms();delay200ms();
 155   3                              P4 |= (1 << 1);                                         //蜂鸣器
 156   3                              delay200ms();delay200ms();
 157   3                              P4 &= ~(1 << 1);
 158   3                              delay200ms();delay200ms();
 159   3                              P4 |= (1 << 1);                                         //蜂鸣器
 160   3                              delay200ms();delay200ms();
 161   3                              P4 &= ~(1 << 1);
 162   3                              delay200ms();delay200ms();
 163   3                              P4 |= (1 << 1);                                         //蜂鸣器
 164   3                              }  
 165   2                      } 
 166   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    324    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   ----    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =      5       8
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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