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

📄 ex5_eeprom.lst

📁 基于摩托罗拉S12标准源程序 包括:SCIO,Timer
💻 LST
📖 第 1 页 / 共 3 页
字号:
ANSI-C/cC++ Compiler for HC12 V-5.0.24 Build 4047, Feb 17 2004

    1:  /******************************************************************************
    2:  * 		                                            COPYRIGHT (c) MOTOROLA 2002   
    3:  * FILE NAME: eeprom.c   REVISION R1B                                                  
    4:  *                                                                           
    5:  * PURPOSE: This module handles all tasks related to internal EEPROM module
    6:  *                                                                       
    7:  *******************************************************************************
    8:  *******************************************************************************  
    9:  **  THIS CODE IS ONLY INTENDED AS AN EXAMPLE FOR THE METROWERKS COMPILER AND **  
   10:  **      THE HCS	12 EVB AND HAS ONLY BEEN GIVEN A MIMIMUM LEVEL OF TEST.      **  
   11:  **  IT IS PROVIDED 'AS SEEN' WITH NO GUARANTEES AND NO PROMISE OF SUPPORT.   **  
   12:  *******************************************************************************  
   13:  *******************************************************************************
   14:  *                                                                           
   15:  * DOCUMENTATION SOURCE: Motorola TSPG 8/16 MCU bit Division (HKG)                                       
   16:  *                                                                           
   17:  * TARGET DEVICE: 		Hardware EVB912DP256 or equivalent                                                                                                                                                      
   18:  *                                                                           
   19:  * INCLUDE FILES:  		<hidef.h>
   20:  *						"com.h"
   21:  *						"DP256Port.h"
   22:  *                                                    
   23:  * FUNCTIONS :  			eeprom_erase_cmd
   24:  *						eeprom_program_cmd
   25:  *						eeprom_program
   26:  *						eeprom_erase
   27:  *                                                                       
   28:  * COMPILER: Metrowerks                     VERSION: ADS v1.2           
   29:  *                                                                           
   30:  * DESCRIPTION: Program to control the EEPROM module  
   31:  *              
   32:  * INPUTS
   33:  * ------      
   34:  * All commands are inovked by PC Hyperterminal via SCI0. 
   35:  *
   36:  * NOTES
   37:  * -----
   38:  * All modules remain at their reset addresses.                                                      
   39:  *                                                                         
   40:  *                                                                         
   41:  * UPDATE HISTORY                                                         
   42:  * REV      AUTHOR       DATE       DESCRIPTION OF CHANGE                  
   43:  * ---      ------      ---------   ---------------------                 
   44:  * R1A      r29566	   02/04/20    Initial version
   45:  * R1B  	   r29566	   02/07/12    Demo version
   46:  *               
   47:  ******************************************************************************/ 
   48:  /*===============================a============================================*/
   49:  /* Motorola reserves the right to make changes without further notice to any */
   50:  /* product herein to improve reliability, function, or design. Motorola does */
   51:  /* not assume any  liability arising  out  of the  application or use of any */
   52:  /* product,  circuit, or software described herein;  neither  does it convey */
   53:  /* any license under its patent rights  nor the  rights of others.  Motorola */
   54:  /* products are not designed, intended,  or authorized for use as components */
   55:  /* in  systems  intended  for  surgical  implant  into  the  body, or  other */
   56:  /* applications intended to support life, or  for any  other application  in */
   57:  /* which the failure of the Motorola product  could create a situation where */
   58:  /* personal injury or death may occur. Should Buyer purchase or use Motorola */
   59:  /* products for any such intended  or unauthorized  application, Buyer shall */
   60:  /* indemnify and  hold  Motorola  and its officers, employees, subsidiaries, */
   61:  /* affiliates,  and distributors harmless against all claims costs, damages, */
   62:  /* and expenses, and reasonable  attorney  fees arising  out of, directly or */
   63:  /* indirectly,  any claim of personal injury  or death  associated with such */
   64:  /* unintended or unauthorized use, even if such claim alleges that  Motorola */
   65:  /* was negligent regarding the  design  or manufacture of the part. Motorola */
   66:  /* and the Motorola logo* are registered trademarks of Motorola Ltd.         */
   67:  /*****************************************************************************/
   68:  
   69:  #include <hidef.h>
   70:  #include "const.h"
   71:  #include "ut_extern.h"
   72:  #include "ex5_extern.h"
   73:  #include "DP256Port.h"
   74:  
   75:  #define pviol		0x20
   76:  #define accerr		0x10
   77:  #define prog		0x20
   78:  #define ccif		0x40
   79:  #define cbeif		0x80
   80:  #define erase		0x40
   81:  
   82:  #define fcnfg 	(*((volatile unsigned char*)(0x0103)))
   83:  #define fstat 	(*((volatile unsigned char*)(0x0105)))
   84:  #define fcmd 	(*((volatile unsigned char*)(0x0106)))
   85:  #define eclkdiv	(*((volatile unsigned char*)(0x0110)))
   86:  #define ecnfg 	(*((volatile unsigned char*)(0x0113)))
   87:  #define eprot 	(*((volatile unsigned char*)(0x0114)))
   88:  #define estat 	(*((volatile unsigned char*)(0x0115)))
   89:  #define ecmd 	(*((volatile unsigned char*)(0x0116)))
   90:  
   91:  /**********************************************
   92:  * PORTB bit test menu subroutine
   93:  * input		: PORTB menu
   94:  * output 	: Corresponding sub-menu
   95:  ***********************************************/
   96:  void eeprom_test_menu(void)
   97:  { 

Function: eeprom_test_menu
Source  : D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\sources\ex5_eeprom.c
Options : -DNON_BANK -Env"GENPATH=D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\bin;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\cmd;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\prm;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\sources;C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\LIB;C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\SRC;C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\INCLUDE" -Env"LIBPATH=C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\INCLUDE" -Env"OBJPATH=D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\bin" -Env"TEXTPATH=D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\bin" -Lasm=%n.lst -ObjN="D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\S12_Ex5_EEPROM_ICD_CW31_Data\FCS\ObjectCode\ex5_eeprom.c.o" -Ol0

  0000 1b9d         LEAS  -3,SP
   98:  	byte cdata,loop=ENABLE;
  0002 c601         LDAB  #1
  0004 6b81         STAB  1,SP
   99:  		
  100:  	while(loop==ENABLE)
  101:  	{ 
  102:  
  103:  	  printf0("\n\t\tEEPROM Test Menu\n\r");
  0006 cc0000       LDD   #"\012\011\011EEPROM Test Menu\012\015"
  0009 160000       JSR   printf0
  104:  	  printf0("\t0. ROOT Test Menu\n\r");
  000c cc0000       LDD   #"\0110. ROOT Test Menu\012\015"
  000f 160000       JSR   printf0
  105:  	  printf0("\t1. EEPROM Program\n\r");
  0012 cc0000       LDD   #"\0111. EEPROM Program\012\015"
  0015 160000       JSR   printf0
  106:  	  printf0("\t2. EEPROM Erase\n\r");
  0018 cc0000       LDD   #"\0112. EEPROM Erase\012\015"
  001b 160000       JSR   printf0
  107:  	  printf0("\t9. Display DATA\n\r");
  001e cc0000       LDD   #"\0119. Display DATA\012\015"
  0021 160000       JSR   printf0
  108:  	
  109:  	  do
  110:  	  {
  111:  	  	cdata=menurx_char0(FLASH_PAGE);
  0024 c610         LDAB  #16
  0026 160000       JSR   menurx_char0
  0029 6b82         STAB  2,SP
  112:  	  	if(cdata==CR || cdata=='9')
  002b c10d         CMPB  #13
  002d 270c         BEQ   *+14 ;abs = 003b
  002f c139         CMPB  #57
  0031 2708         BEQ   *+10 ;abs = 003b
  113:  	      break;
  114:  	  }	  
  115:  	  while((cdata>'3') || (cdata<'0'));
  0033 c133         CMPB  #51
  0035 22ed         BHI   *-17 ;abs = 0024
  0037 c130         CMPB  #48
  0039 25e9         BCS   *-21 ;abs = 0024
  116:  	  		//get input from user
  117:  	  
  118:  	  switch(cdata)
  003b c139         CMPB  #57
  003d 2226         BHI   *+40 ;abs = 0065
  003f c130         CMPB  #48
  0041 6b80         STAB  0,SP
  0043 250d         BCS   *+15 ;abs = 0052
  0045 c132         CMPB  #50
  0047 2209         BHI   *+11 ;abs = 0052
  0049 c030         SUBB  #48
  004b 87           CLRA  
  004c 160000       JSR   _CASE_DIRECT_BYTE
  004f 1b           DC.B  27
  0050 09           DC.B  9
  0051 0e           DC.B  14
  0052 c139         CMPB  #57
  0054 270c         BEQ   *+14 ;abs = 0062
  0056 200d         BRA   *+15 ;abs = 0065
  119:  	  { 
  120:  		case	'0': loop=DISABLE;
  121:  					 break;
  122:  		case 	'1': eeprom_program();				//flash_program(); 
  0058 160000       JSR   eeprom_program
  123:  					 break;
  005b 2008         BRA   *+10 ;abs = 0065
  124:  		case  	'2': eeprom_erase();
  005d 160000       JSR   eeprom_erase
  125:  					 break;		 
  0060 2003         BRA   *+5 ;abs = 0065
  126:  		case  	'9': data_display(); 
  0062 160000       JSR   data_display
  0065 e681         LDAB  1,SP
  0067 04119c       DBEQ  B,*-97 ;abs = 0006
  127:  					 break;
  128:  	  }	
  129:  	}		
  130:  }
  006a 1b83         LEAS  3,SP
  006c 3d           RTS   
  131:  
  132:  
  133:  /*******************************************************************
  134:  * EEPROM program command subroutine
  135:  * Description : Copy from RAM area to EEPROM area
  136:  *             : Input RAM,EEPROM start address and no. of word to be
  137:  *             : programmed
  138:  * Example     : Copy 4 words from RAM(0x1000) to EEPROM (0x600) 
  139:  * input 	  : eram_addi=0x1000, eeprom_addi=0x600, no_of word=0x4
  140:  * modify      : eeprom content (0x600 to 0x608)= (0x1000 to 0x1008)
  141:  *********************************************************************/ 
  142:  void eeprom_program_cmd(int eram_addi, int eeprom_addi, int no_of_word)
  143:  {

Function: eeprom_program_cmd
Source  : D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\sources\ex5_eeprom.c
Options : -DNON_BANK -Env"GENPATH=D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\bin;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\cmd;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\prm;D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\sources;C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\LIB;C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\SRC;C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\INCLUDE" -Env"LIBPATH=C:\Program Files\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\INCLUDE" -Env"OBJPATH=D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\bin" -Env"TEXTPATH=D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\bin" -Lasm=%n.lst -ObjN="D:\Profiles\r63492.FSL\My Documents\Training document\培训教材\HCS12\S12 Ex5 EEPROM ICD CW31\S12_Ex5_EEPROM_ICD_CW31_Data\FCS\ObjectCode\ex5_eeprom.c.o" -Ol0

  0000 6ca8         STD   8,-SP
  144:  	int *ram_add,*eeprom_add,count=0;
  0002 c7           CLRB  
  0003 87           CLRA  

⌨️ 快捷键说明

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