#include "IFsh1.h" #include "BTN1.h" #include "Inhr1.h" #include "AS1.h" #include "PE_Types.h" #include "PE_Error.h" #include "PE_Const.h" #include "IO_Map.h" #include "Events.h" #include "Cpu.h"
上述头文件我不太懂,是否全部是软件中
#include文件夹自带的文件呢?#include "PE_Types.h",#include "PE_Error.h",#include "PE_Const.h",#include "IO_Map.h"我知道是PE生成的文件。#include "IFsh1.h",#include "BTN1.h",#include "Inhr1.h",#include "AS1.h"是文件夹里面自带的吗?那#include "Events.h",#include "Cpu.h"呢,是生成的,还是自带的? /* Global variables */ volatile word SR_lock=0;
/* Lock */ volatile word SR_reg;
/* Current value of the SR register */
volatile是什么函数,那里可以找到它的声明,这些函数的声明一般在哪里可以找到? #pragma interrupt
void Cpu_Interrupt(void) {
asm(DEBUG);
/* Halt the core and placing it in the debug processing state */ } void Cpu_DisableInt(void) void Cpu_EnableInt(void)
**
This method is implemented as macro in the header module. void Cpu_SetStopMode(void)void Cpu_SetWaitMode(void)
void Cpu_SetDataMode(byte Mode)
{
if (Mode == INT_EXT_MODE) asm { bfclr
#0x0008,OMR }
不懂的地方,不明白#0x0008寄存器地址从哪里可以看到,可以找到所有的寄存器和相应地址呢?
/* Set internal and external data memory mode */
else
asm { bfset
#0x0008,OMR }
/* Set external data memory mode */ }
byte Cpu_GetSpeedMode(void){
return HIGH_SPEED;
这里为什么要返回HIGH_SPEED呢?
/* Result the actual cpu mode - high speed mode*/ }
extern void init_56800_(void);
/* Forward declaration of external startup function declared in startup file */
/*** !!! Here you can place your own code using property "User data declarations" on the build options tab. !!! ***/ 我应该添加什么样的代码?
Void _EntryPoint(void) {
/*** !!! Here you can place your own code before PE initialization using property “User code before PE initialization” on the build options tab. !!! ***/ 问题同上
setReg(PLLCR, (PLLCR_LCKON_MASK | PLLCR_ZSRC0_MASK)); /* Enable PLL, LCKON and select clock source from prescaler */setReg是什么? PLLCR是什么?锁相环寄存器吗,
那么PLLCR_LCKON_MASK和PLLCR_ZSRC0_MASK又是什么?
setReg16(CLKOSR, 0);
/* CLKO = ZCLOCK */
CLKOSR是什么?
setReg16(PLLDB, 8487);
/* Set the clock prescalers */
PLLDB是什么?
while(!getRegBit(PLLSR, LCK0)){}
/* Wait for PLL lock */ PLLSR, LCK0是什么?
setReg(PLLCR, (PLLCR_LCKON_MASK | PLLCR_ZSRC1_MASK)); /* Select clock source from postscaler */
setReg16(BCR, 0);
/* Bus control register */ BCR是什么?
asm(JMP init_56800_);
/* Jump to C startup code */ }
void PE_low_level_init(void)
{
PE_low_level_init是自定义的吗,还是已有的寄存器? /* Common initialization of the CPU registers */
/* IPR: CH3=1,IAL1=1,IAINV=0 */
clrSetReg16Bits(IPR, 1, 4100);
clrSetReg16Bits是什么指令?IPR是什么寄存器?
clrSetReg16Bits(GPR3, 3, 4);
GPR是什么?
setReg16Bits(GPIO_E_PER, 3);
clrSetReg16Bits(GPR13, 51, 68);
clrSetReg16Bits(GPR12, 13056, 17408);
IFsh1_Init(); 末尾为什么还要初始化?
setRegBit(IPR,IAL0);
BTN1_Init(); 问题同上
AS1_Init(); 问题同上?
__EI();
}
[此贴子已经被作者于2008-12-21 16:22:37编辑过] |