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

📄 cpu.c

📁 飞思卡尔ee的运用
💻 C
字号:
/** ###################################################################
**     THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
**     Filename  : Cpu.C
**     Project   : eeprom
**     Processor : MC9S12HZ64CFU
**     Beantype  : MC9S12HZ64_80
**     Version   : Bean 01.001, Driver 02.01, CPU db: 2.87.443
**     Datasheet : MC9S12HZ256 Rev. 2.01 10/2005
**     Compiler  : CodeWarrior HC12 C Compiler
**     Date/Time : 2008-12-15, 下午 02:15
**     Abstract  :
**         This bean "MC9S12HZ64_80" implements properties, methods,
**         and events of the CPU.
**     Settings  :
**
**     Contents  :
**         EnableInt   - void Cpu_EnableInt(void);
**         DisableInt  - void Cpu_DisableInt(void);
**         SetWaitMode - void Cpu_SetWaitMode(void);
**         SetStopMode - void Cpu_SetStopMode(void);
**
**     (c) Copyright UNIS, spol. s r.o. 1997-2007
**     UNIS, spol. s r.o.
**     Jundrovska 33
**     624 00 Brno
**     Czech Republic
**     http      : www.processorexpert.com
**     mail      : info@processorexpert.com
** ###################################################################*/

/* MODULE Cpu. */

#include "IEE1.h"
#include "EInt1.h"
#include "Events.h"
#include "Cpu.h"

#define CGM_DELAY  1023UL

#pragma DATA_SEG DEFAULT
#pragma CODE_SEG DEFAULT


/* Global variables */
volatile byte CCR_reg;                 /* Current CCR reegister */
#pragma CODE_SEG __NEAR_SEG NON_BANKED


/*
** ===================================================================
**     Method      :  Cpu_Cpu_Interrupt (bean MC9S12HZ64_80)
**
**     Description :
**         The method services unhandled interrupt vectors.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
ISR(Cpu_Interrupt)
{
  asm(BGND);
}


#pragma CODE_SEG DEFAULT

/*
** ===================================================================
**     Method      :  Cpu_DisableInt (bean MC9S12HZ64_80)
**
**     Description :
**         Disable maskable interrupts
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
/*
void Cpu_DisableInt(void)

**      This method is implemented as macro in the header module. **
*/

/*
** ===================================================================
**     Method      :  Cpu_EnableInt (bean MC9S12HZ64_80)
**
**     Description :
**         Enable maskable interrupts
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
/*
void Cpu_EnableInt(void)

**      This method is implemented as macro in the header module. **
*/

/*
** ===================================================================
**     Method      :  Cpu_SetStopMode (bean MC9S12HZ64_80)
**
**     Description :
**         Set low power mode - Stop mode.
**         For more information about the stop mode see
**         documentation of this CPU.
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
/*
void Cpu_SetStopMode(void)

**      This method is implemented as macro in the header module. **
*/

/*
** ===================================================================
**     Method      :  Cpu_SetWaitMode (bean MC9S12HZ64_80)
**
**     Description :
**         Set low power mode - Wait mode.
**         For more information about the wait mode see
**         documentation of this CPU.
**         Release from Wait mode: Reset or interrupt
**     Parameters  : None
**     Returns     : Nothing
** ===================================================================
*/
/*
void Cpu_SetWaitMode(void)

**      This method is implemented as macro in the header module. **
*/

/*
** ===================================================================
**     Method      :  _EntryPoint (bean MC9S12HZ64_80)
**
**     Description :
**         Initializes the whole system like timing and so on. At the end 
**         of this function, the C startup is invoked to initialize stack,
**         memory areas and so on.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
extern void _Startup(void);            /* Forward declaration of external startup function declared in file Start12.c */
#pragma CODE_SEG __NEAR_SEG NON_BANKED

#define INITRG_ADR  0x0011             /* Register map position register */

#pragma NO_FRAME
#pragma NO_EXIT
void _EntryPoint(void)
{
  /* ### MC9S12HZ64_80 "Cpu" init code ... */
  /*  PE initialization code after reset */
  /* Initialization of the registers INITRG, INITRM, INITEE is done to protect them to be written accidentally later by the application */
  *(byte*)INITRG_ADR = 0;              /* Set the register map position */
  asm("nop");                          /* nop instruction */
  /* INITRM: RAM15=0,RAM14=0,RAM13=0,RAM12=0,RAM11=1,??=0,??=0,RAMHAL=1 */
  setReg8(INITRM, 9);                  /* Set the RAM map position */ 
  /* INITEE: EE15=0,EE14=0,EE13=0,EE12=0,EE11=1,??=0,??=0,EEON=1 */
  setReg8(INITEE, 9);                  /* Set the EEPROM map position */ 
  /* MISC: ??=0,??=0,??=0,??=0,EXSTR1=1,EXSTR0=1,ROMHM=0,ROMON=1 */
  setReg8(MISC, 13);                    
  /* PEAR: NOACCE=0,??=0,PIPOE=0,NECLK=0,LSTRE=0,RDWE=0,??=0,??=0 */
  setReg8(PEAR, 0);                     
  /*  System clock initialization */
  /* CLKSEL: PLLSEL=0,PSTP=0,SYSWAI=0,ROAWAI=0,PLLWAI=0,CWAI=0,RTIWAI=0,COPWAI=0 */
  setReg8(CLKSEL, 0);                  /* Select clock source from XTAL and set bits in CLKSEL reg. */ 
  /* PLLCTL: CME=1,PLLON=0,AUTO=1,ACQ=1,??=0,PRE=0,PCE=0,SCME=1 */
  setReg8(PLLCTL, 177);                /* Disable the PLL */ 
  /*** End of PE initialization code after reset ***/
  __asm("jmp _Startup");               /* Jump to C startup code */
}

#pragma CODE_SEG DEFAULT
/*
** ===================================================================
**     Method      :  PE_low_level_init (bean MC9S12HZ64_80)
**
**     Description :
**         Initializes beans and provides common register initialization. 
**         The method is called automatically as a part of the 
**         application initialization code.
**         This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
void PE_low_level_init(void)
{
  /* Common initialization of the CPU registers */
  /* PPSAD: PPSAD0=1 */
  setReg8Bits(PPSAD, 1);                
  /* PERAD: PERAD0=0 */
  clrReg8Bits(PERAD, 1);                
  /* DDRAD: DDRAD0=0 */
  clrReg8Bits(DDRAD, 1);                
  /* ATDDIEN1: IEN0=1 */
  setReg8Bits(ATDDIEN1, 1);             
  /* CRGINT: LOCKIE=0,SCMIE=0 */
  clrReg8Bits(CRGINT, 18);              
  /* VREGCTRL: LVIE=0 */
  clrReg8Bits(VREGCTRL, 2);             
  /* COPCTL: RSBCK=0 */
  clrReg8Bits(COPCTL, 64);              
  /* RDRIV: RDPK=0,RDPE=0,RDPB=0,RDPA=0 */
  clrReg8Bits(RDRIV, 147);              
  /* RDRM: RDRM3=0,RDRM2=0 */
  clrReg8Bits(RDRM, 12);                
  /* RDRP: RDRP5=0,RDRP4=0,RDRP3=0,RDRP1=0 */
  clrReg8Bits(RDRP, 58);                
  /* RDRS: RDRS6=0,RDRS4=0,RDRS1=0,RDRS0=0 */
  clrReg8Bits(RDRS, 83);                
  /* RDRT: RDRT3=0,RDRT2=0,RDRT1=0,RDRT0=0 */
  clrReg8Bits(RDRT, 15);                
  /* RDRAD: RDRAD6=0,RDRAD5=0,RDRAD4=0,RDRAD3=0,RDRAD2=0,RDRAD1=0,RDRAD0=0 */
  clrReg8Bits(RDRAD, 127);              
  /* SRRU: SRRU7=0,SRRU6=0,SRRU5=0,SRRU4=0,SRRU3=0,SRRU2=0,SRRU1=0,SRRU0=0 */
  setReg8(SRRU, 0);                     
  /* SRRV: SRRV7=0,SRRV6=0,SRRV5=0,SRRV4=0,SRRV3=0,SRRV2=0,SRRV1=0,SRRV0=0 */
  setReg8(SRRV, 0);                     
  /* INTCR: IRQEN=0 */
  clrReg8Bits(INTCR, 64);               
  /* ### MC9S12HZ64_80 "Cpu" init code ... */
  /* ### IntEEPROM "IEE1" init code ... */
  IEE1_Init();
  /* ### External interrupt "EInt1" init code ... */
  PIFAD = 1;                            /* Clear flag */
  PIEAD_PIEAD0 = 1;                    /* Enable interrupt */
  __EI();                              /* Enable interrupts */
}

/* END Cpu. */

/*
** ###################################################################
**
**     This file was created by UNIS Processor Expert 2.98 [03.98]
**     for the Freescale HCS12 series of microcontrollers.
**
** ###################################################################
*/

⌨️ 快捷键说明

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