📄 cpu.c
字号:
/** ###################################################################
** THIS BEAN MODULE IS GENERATED BY THE TOOL. DO NOT MODIFY IT.
** Filename : Cpu.C
** Project : LowFreqSG
** Processor : MC68HC908LV8CFA
** Beantype : MC68HC908LV8_52
** Version : Bean 01.078, Driver 01.36, CPU db: 2.89.060
** Datasheet : MC68HC908LV8 Rev. 2 12/2005
** Compiler : CodeWarrior HC08 C Compiler
** Date/Time : 2006-9-6, 11:29
** Abstract :
** This bean "MC68HC908LV8_52" implements properties, methods,
** and events of the CPU.
** Settings :
** Clock setting
** External clock : 0.032768 MHz
** CPU mode selection : 1
** Initialization interrupt priority : 0
** Stop instruction enabled : no
** LVI module : no
**
** Speed modes
** High speed clock : Main clock frequency / 1
** Internal bus clock : 7.995392 MHz
** Low speed mode : Disabled
** Slow speed mode : Disabled
** Contents :
** EnableInt - void Cpu_EnableInt(void);
** DisableInt - void Cpu_DisableInt(void);
**
** (c) Copyright UNIS, spol. s r.o. 1997-2006
** UNIS, spol. s r.o.
** Jundrovska 33
** 624 00 Brno
** Czech Republic
** http : www.processorexpert.com
** mail : info@processorexpert.com
** ###################################################################*/
/* MODULE Cpu. */
#include "LCD1.h"
#include "TO1.h"
#include "PE_Types.h"
#include "PE_Error.h"
#include "PE_Const.h"
#include "IO_Map.h"
#include "Cpu.h"
#define CGM_DELAY 0xFFUL
/* Global variables */
volatile byte CCR_reg; /* Current CCR register */
byte CpuMode = HIGH_SPEED; /* Current speed mode */
/*
** ===================================================================
** Method : Cpu_Interrupt (bean MC68HC908LV8_52)
**
** Description :
** This ISR services unhandled interrupt vectors.
** This method is internal. It is used by Processor Expert only.
** ===================================================================
*/
ISR(Cpu_Interrupt)
{
/* The following code is generated from the 'Unhandled interrupt code' */
/* property on the 'Build option tab' of the CPU bean */
/* (can be modified by the user) */
asm {
swi
}
}
/*
** ===================================================================
** Method : Cpu_DisableInt (bean MC68HC908LV8_52)
**
** Description :
** Disables maskable interrupts
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
/*
void Cpu_DisableInt(void)
** This method is implemented as macro in the header module. **
*/
/*
** ===================================================================
** Method : Cpu_EnableInt (bean MC68HC908LV8_52)
**
** Description :
** Enables maskable interrupts
** Parameters : None
** Returns : Nothing
** ===================================================================
*/
/*
void Cpu_EnableInt(void)
** This method is implemented as macro in the header module. **
*/
/*
** ===================================================================
** Method : _EntryPoint (bean MC68HC908LV8_52)
**
** 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 compiler startup function */
#pragma NO_FRAME
#pragma NO_EXIT
void _EntryPoint(void)
{
/*### MC68HC908LV8_52 - system initialization */
/* Common initialization of the write once registers */
/* CONFIG1: COPRS=0,LVISTOP=0,LVIRSTD=0,LVIPWRD=1,??=0,SSREC=0,STOP=0,COPD=1 */
setReg8(CONFIG1, 0x11);
/* CONFIG2: STOP_XCLKEN=0,??=0,PEE=1,PDE=1,PCEH=0,PCEL=1,LVISEL1=0,LVISEL0=1 */
setReg8(CONFIG2, 0x35);
/* PCTL: BCS=0 */
clrReg8Bits(PCTL, 0x10); /* Select clock source from XTAL */
/* PCTL: PLLON=0 */
clrReg8Bits(PCTL, 0x20); /* Disable the PLL */
/* PCTL: PLLIE=0,PLLF=0,PLLON=0,BCS=0,PRE1=0,PRE0=0,VPR1=1,VPR0=0 */
setReg8(PCTL, 0x02); /* Set VCO output Power-of-Two devider P=0 the VCO Power-of-Two multiplier E=2 */
/* PMS: ??=0,??=0,??=0,??=0,MUL11=0,MUL10=0,MUL9=1,MUL8=1,MUL7=1,MUL6=1,MUL5=0,MUL4=1,MUL3=0,MUL2=0,MUL1=0,MUL0=0 */
setReg16(PMS, 0x03D0); /* Set the Feedback divider N=976 */
/* PMRS: VRS7=1,VRS6=1,VRS5=0,VRS4=1,VRS3=0,VRS2=0,VRS1=0,VRS0=0 */
setReg8(PMRS, 0xD0); /* Set the VCO Linear multiplier L=208 */
/* PMDS: ??=0,??=0,??=0,??=0,RDS3=0,RDS2=0,RDS1=0,RDS0=1 */
setReg8(PMDS, 0x01); /* Set the Reference clock devider R=1 */
/* PBWC: AUTO=1,LOCK=0,ACQ=0,??=0,??=0,??=0,??=0,??=0 */
setReg8(PBWC, 0x80); /* Select the operating modes */
/* PCTL: PLLON=1 */
setReg8Bits(PCTL, 0x20); /* Enable the PLL */
while(!PBWC_LOCK) { /* Wait */
}
/* PCTL: BCS=1 */
setReg8Bits(PCTL, 0x10); /* Select clock source from PLL */
__asm("nop");
__asm("nop");
/*** End of PE initialization code after reset ***/
__asm jmp _Startup ; /* Jump to C startup code */
}
/*
** ===================================================================
** Method : PE_low_level_init (bean MC68HC908LV8_52)
**
** 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 */
/* DDRB: DDRB4=0 */
clrReg8Bits(DDRB, 0x10);
/* HDB: HDB4=1 */
setReg8Bits(HDB, 0x10);
/* LVISR: LVIIE=0 */
clrReg8Bits(LVISR, 0x40);
/* ### MC68HC908LV8_52 "Cpu" init code ... */
/* ### LCD "LCD1" init code ... */
LCD1_Init();
/* ### TimerOut "TO1" init code ... */
TO1_Init();
__DI(); /* Disable interrupts */
}
/* Initialization of the CPU registers in FLASH */
/* END Cpu. */
/*
** ###################################################################
**
** This file was created by UNIS Processor Expert 2.98 [03.80]
** for the Freescale HC08 series of microcontrollers.
**
** ###################################################################
*/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -