#include"main.h"
void CpuInit(void);
//主程序
int main(void)
{
CpuInit();
while(1)
{
;
}
}
//
单片机初始化
void CpuInit(void)
{
//设置内核时钟频率为最大 10.24MHz
//定时器1初始化
T1LD = 0x80; // 32768 clock
ticks
T1CON = 0xC0; // Periodic mode, enable timer, 32768hz clock/1
IRQEN |= 0x10;
PLLKEY1 = 0xAA; // Switch to external crystal
PLLCON = 0x02;
PLLKEY2 = 0x55;
POWKEY1 = 0x1;
POWCON0 = 0x73;
POWKEY2 = 0xF4;
//IO口配置
GP1DAT = 0x60000000; // Configure P1.6 P1.5 as an output
}
//中断向量
void IRQ_Handler(void)__irq
{
//定时器1中断
if(IRQSIG 0x00000010)
{
GP1DAT ^= BIT22; // Toggle LED on Evaluation board (P1.6)
T1CLRI = 0; // Clear the currently active Timer0 Irq
}
}