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

📄 s12x_e_io.lst

📁 freescale 协处理器应用相关实例
💻 LST
📖 第 1 页 / 共 2 页
字号:
ANSI-C/cC++ Compiler for HC12 V-5.0.30 Build 6157, Jun  7 2006

    1:  /******************************************************************************
    2:  		                                             COPYRIGHT (c) Freescale 2006   
    3:  FILE NAME: S12X_E_IO.C                                                      
    4:                                                                            
    5:  PURPOSE: S12X D family i/o configuration      											 
    6:                                                                            
    7:  TARGET DEVICE: S12XEP100                                               
    8:                                                                            
    9:  INCLUDE FILES: s12_io.h, target.h                                               
   10:                                                                            
   11:  FUNCTIONS :  ConfigurePorts                                                    
   12:                                                     
   13:  Tasks	 :  none                                                  			 
   14:  Hooks   :	 none                                                            
   15:  ISRs	 :	 none                                                                
   16:                                                                           
   17:  COMPILER: Metrowerks                     
   18:                                                                            
   19:  DESCRIPTION: Routine to configure S12XEP100                                             
   20:                                                                            
   21:  NOTES
   22:  -----
   23:  E-clk can be monitored on jumper PE4.
   24:                                                                            
   25:  UPDATE HISTORY                                                            
   26:  REV      AUTHOR      DATE         DESCRIPTION OF CHANGE                    
   27:  ---      ------      ---------    ---------------------                   
   28:  1.0      r32151      13/10/05     Initial coding 
   29:  1.1      r32151      26/01/06     ATD ports corrected
   30:                                                                             
   31:  
   32:       *******************************************************************
   33:       * File created by: Freescale East Kilbride MCD Applications Group *
   34:       *******************************************************************
   35:  
   36:                                                                            
   37:  ******************************************************************************/
   38:  /*===========================================================================*/
   39:  /* Freescale reserves the right to make changes without further notice to any*/
   40:  /* product herein to improve reliability, function, or design. Freescale does*/
   41:  /* not assume any  liability arising  out  of the  application or use of any */
   42:  /* product,  circuit, or software described herein;  neither  does it convey */
   43:  /* any license under its patent rights  nor the  rights of others.  Freescale*/
   44:  /* products are not designed, intended,  or authorized for use as components */
   45:  /* in  systems  intended  for  surgical  implant  into  the  body, or  other */
   46:  /* applications intended to support life, or  for any  other application  in */
   47:  /* which the failure of the Freescale product  could create a situation where*/
   48:  /* personal injury or death may occur. Should Buyer purchase or use Freescale*/
   49:  /* products for any such intended  or unauthorized  application, Buyer shall */
   50:  /* indemnify and  hold  Freescale  and its officers, employees, subsidiaries,*/
   51:  /* affiliates,  and distributors harmless against all claims costs, damages, */
   52:  /* and expenses, and reasonable  attorney  fees arising  out of, directly or */
   53:  /* indirectly,  any claim of personal injury  or death  associated with such */
   54:  /* unintended or unauthorized use, even if such claim alleges that  Freescale*/
   55:  /* was negligent regarding the  design  or manufacture of the part. Freescale*/
   56:  /* and the Freescale logo* are registered trademarks of Freescale Ltd.       */
   57:  /*****************************************************************************/
   58:  
   59:  /************************* Include Files *************************************/
   60:  #include "s12x_peripherals.h"
   61:  #include "target.h"  /* includes device peripheral declarations */
   62:  #include "S12_io.h"
   63:  
   64:  
   65:  /************************* typedefs ******************************************/
   66:  /* in s12x_vectors.h */
   67:  /************************* function prototypes *******************************/
   68:  /* in s12x_vectors.h */
   69:  //#define ECLK_OUT					/* uncomment for Debug */
   70:  /************************* #defines ******************************************/
   71:  /* in s12x_vectors.h */
   72:  /************************* Constants *****************************************/
   73:  #pragma CONST_SEG DEFAULT
   74:  /************************* Global Variables **********************************/
   75:  #pragma DATA_SEG DEFAULT
   76:  /************************* Functions *****************************************/
   77:  #pragma CODE_SEG DEFAULT 
   78:  
   79:  /******************************************************************************
   80:  Function Name	:	ConfigurePorts
   81:  Engineer		   :	r32151
   82:  Date			   :	01/03/05
   83:  Headers			: 	s12_io.h, target.h
   84:  Parameters		:	NONE
   85:  Returns			:	NONE
   86:  Notes			   :	Code to set up i/o ports 
   87:  ******************************************************************************/
   88:  void
   89:  ConfigurePorts(void)
   90:  {

Function: ConfigurePorts
Source  : D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Sources\s12X_E_io.c
Options : -CPUHCS12XE -D__FAR_DATA -D__NO_FLOAT__ -Env"GENPATH=D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\bin;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\prm;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\cmd;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Sources;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\lib;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\src;C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\lib;*C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\src;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Sources\Configuration;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\defs_XEx100_M22E;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\include;C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\include" -Env"LIBPATH=D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\bin;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\prm;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\cmd;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Sources;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\lib;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\src;C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\lib;*C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\src;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Sources\Configuration;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\defs_XEx100_M22E;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\include;C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\include" -Env"OBJPATH=D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\bin" -Env"TEXTPATH=D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\bin" -Lasm=%n.lst -Mb -ObjN="D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Example_9_Data\Flash_P&E_target\ObjectCode\s12X_E_io.c.o" -WmsgSd1106

   91:  
   92:  /******* CORE PORTS ********/
   93:  
   94:  /* core interrupts */
   95:  /* This register register was renamed. On early D, A and H families it is called INTCR,
   96:     on all other families it is called IRQCR. */
   97:  	IRQCR.byte = 0;		/* IRQ only responds to falling edge  */
  0000 790000       [3]     CLR   IRQCR
   98:  								/*	- note IRQE is write once */								
   99:  
  100:  /*include this line to clear the X-bit in order to enable the XIRQ function */   
  101:  //  asm ANDCC #~BIT6;	
  102:  
  103:  /* drive level */
  104:  	RDRIV.byte = ALL_REDUCED_DRIVE;						/* core ports reduced drive */
  0003 c6ff         [1]     LDAB  #255
  0005 5b00         [2]     STAB  RDRIV
  105:  /* Enable Pull devices */
  106:  	PUCR.byte 	= ALL_PULLS_ON; 							/* Note: only pull-ups available on core ports */
  0007 5b00         [2]     STAB  PUCR
  107:  						  						/* some port E pins require care when using external pull devices*/
  108:  						  						/* port E.7: pull up for LC Pierce, tie low for ext osc or full Pierce, */
  109:  						  						/*           reset enables internal pull up.                     */
  110:  						  						/* port E.5 & E.6 should be pulled down for single chip use      */
  111:  						  						/*           reset enables internal pull down.                   */
  112:  /* configure port data and direction */
  113:  /* PORT A */
  114:  	PORTA.byte = ALL_LOW;	   
  0009 790000       [3]     CLR   PORTA
  115:  	DDRA.byte = ALL_INPUTS;
  000c 790000       [3]     CLR   DDRA
  116:  /* PORT B */
  117:  	PORTB.byte = ALL_HIGH;	   					
  000f 5b00         [2]     STAB  PORTB
  118:  	DDRB.byte = ALL_OUTPUTS; 					    
  0011 5b00         [2]     STAB  DDRB
  119:  /* PORT C */
  120:  	PORTC.byte = ALL_LOW;	   
  0013 790000       [3]     CLR   PORTC
  121:  	DDRC.byte = ALL_INPUTS;
  0016 790000       [3]     CLR   DDRC
  122:  /* PORT D */
  123:  	PORTD.byte = ALL_LOW;	   					
  0019 790000       [3]     CLR   PORTD
  124:  	DDRD.byte = ALL_INPUTS; 					    
  001c 790000       [3]     CLR   DDRD
  125:  /* PORT E */
  126:  	PORTE.byte = ALL_LOW;	   
  001f 790000       [3]     CLR   PORTE
  127:  	DDRE.byte = ALL_INPUTS; 		
  0022 790000       [3]     CLR   DDRE
  128:  /* PORT K */
  129:  	PORTK.byte = ALL_LOW;	   
  0025 790000       [3]     CLR   PORTK
  130:  	DDRK.byte = ALL_INPUTS;
  0028 790000       [3]     CLR   DDRK
  131:  	
  132:  /******* PIM PORTS ********/
  133:  
  134:  /* PORT T */
  135:  /* Configure Pull-polarity */
  136:  	PPST.byte 	= ALL_PULLED_DOWN;
  002b 7b0000       [3]     STAB  PPST
  137:  /* Enable Pull devices */
  138:  	PERT.byte 	= ALL_PULLS_ON;
  002e 7b0000       [3]     STAB  PERT
  139:  /* drive level */
  140:  	RDRT.byte 	= ALL_REDUCED_DRIVE;
  0031 7b0000       [3]     STAB  RDRT
  141:  /* port data */
  142:  	PTT.byte 	= ALL_LOW;   
  0034 790000       [3]     CLR   PTT
  143:  /* port direction */
  144:  	DDRT.byte 	= ALL_INPUTS;
  0037 790000       [3]     CLR   DDRT
  145:  
  146:  /* PORT S */
  147:  /* Configure Pull-polarity */
  148:  	PPSS.byte 	= ALL_PULLED_DOWN;
  003a 7b0000       [3]     STAB  PPSS
  149:  /* Enable Pull devices */
  150:  
  151:  /* Enable Pull devices */
  152:  	PERS.byte 	= ALL_PULLS_ON;					
  003d 7b0000       [3]     STAB  PERS
  153:  //	PERS.byte 	= BIT7|BIT6|BIT5|BIT4;					/* S12 EVB - no pull devices on port S0-3 due to avoid */ 
  154:  																	/* conflict with connections to RS232 transceiver */
  155:  /* drive level */
  156:  	RDRS.byte 	= ALL_REDUCED_DRIVE;
  0040 7b0000       [3]     STAB  RDRS
  157:  /* Configure wired-or outputs */
  158:  	WOMS.byte 	= 0x00;
  0043 790000       [3]     CLR   WOMS
  159:  /* port data */
  160:  	PTS.byte 	= ALL_LOW;	   
  0046 790000       [3]     CLR   PTS
  161:  /* port direction */
  162:  	DDRS.byte 	= ALL_INPUTS;
  0049 790000       [3]     CLR   DDRS
  163:  	
  164:  /* PORT M */
  165:  /* Configure Pull-polarity */
  166:  	PPSM.byte = ALL_PULLED_DOWN;
  004c 7b0000       [3]     STAB  PPSM
  167:  /* Enable Pull devices */
  168:  	PERM.byte 	= ALL_PULLS_ON; 	
  004f 7b0000       [3]     STAB  PERM
  169:  //	PERM.byte 	= BIT7|BIT6|BIT5|BIT4|BIT3|BIT2|BIT1; 	/* S12 EVB - no pull device enebled on port M0 as it's */
  170:  																  	   /*driven by the CAN transceiver Rx pin */
  171:  /* drive level */
  172:  	RDRM.byte 	= ALL_REDUCED_DRIVE;
  0052 7b0000       [3]     STAB  RDRM
  173:  /* Configure wired-or outputs */
  174:  	WOMM.byte 	= 0x00;	   
  0055 790000       [3]     CLR   WOMM
  175:  /* port data */
  176:  	PTM.byte 	= ALL_LOW;	   
  0058 790000       [3]     CLR   PTM
  177:  /* port direction */
  178:  	DDRM.byte 	= ALL_INPUTS;
  005b 790000       [3]     CLR   DDRM
  179:  	
  180:  /* PORT P */
  181:  /* Configure Pull-polarity */
  182:  	PPSP.byte 	= ALL_PULLED_UP;
  005e 790000       [3]     CLR   PPSP
  183:  /* Enable Pull devices */
  184:  	PERP.byte 	= ALL_PULLS_ON;
  0061 7b0000       [3]     STAB  PERP
  185:  /* drive level */
  186:  	RDRP.byte 	= ALL_REDUCED_DRIVE;						
  0064 7b0000       [3]     STAB  RDRP
  187:  /* port data */
  188:  	PTP.byte 	= ALL_LOW;		   
  0067 790000       [3]     CLR   PTP
  189:  /* port direction */
  190:  	DDRP.byte 	= ALL_INPUTS;     
  006a 790000       [3]     CLR   DDRP
  191:  /* Clear all interrupt flags */
  192:  	PIFP.byte 	= 0xFF;
  006d 7b0000       [3]     STAB  PIFP
  193:  /* Enable interrupts */
  194:  	PIEP.byte 	= 0x00;
  0070 790000       [3]     CLR   PIEP
  195:  	
  196:  /* PORT H */
  197:  /* Configure Pull-polarity */
  198:  	PPSH.byte 	= ALL_PULLED_UP;	/* EVB - PortH should always pulled up */
  0073 790000       [3]     CLR   PPSH
  199:  /* Enable Pull devices */
  200:  	PERH.byte 	= ALL_PULLS_ON;								
  0076 7b0000       [3]     STAB  PERH
  201:  /* drive level */
  202:  	RDRH.byte 	= ALL_REDUCED_DRIVE;
  0079 7b0000       [3]     STAB  RDRH
  203:  /* port data */
  204:  	PTH.byte 	= ALL_LOW;	   
  007c 790000       [3]     CLR   PTH
  205:  /* port direction */
  206:  	DDRH.byte 	= ALL_INPUTS;
  007f 790000       [3]     CLR   DDRH
  207:  //	DDRH.byte 	= 0x0F;           /* S12X EVB, LEDs on lower nibble, switches on upper - pull up */
  208:  /* Clear all interrupt flags */
  209:  	PIFH.byte 	= 0xFF;
  0082 7b0000       [3]     STAB  PIFH
  210:  /* Enable interrupts */
  211:  	PIEH.byte 	= 0x00;
  0085 790000       [3]     CLR   PIEH
  212:  
  213:  /* PORT J */

⌨️ 快捷键说明

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