/****************************************Copyright (c)**************************************************
** Guangzou ZLG-MCU Development Co.,LTD.
** graduate school
** http://www.zlgmcu.com
**
**--------------File Info-------------------------------------------------------------------------------
** File name: target.c
** Last modified Date: 2004-09-17
** Last Version: 1.0
** Descriptions: header file of the specific codes for LPC2100 target boards
** Every project should include a copy of this file, user may modify it as needed
**------------------------------------------------------------------------------------------------------
** Created by: Chenmingji
** Created date: 2004-02-02
** Version: 1.0
** Descriptions: The original version
**
**------------------------------------------------------------------------------------------------------
** Modified by: Chenmingji
** Modified date: 2004-09-17
** Version: 1.01
** Descriptions: Renewed the template, added more compiler supports
**
**------------------------------------------------------------------------------------------------------
** Modified by: daimaobo
** Modified date: 2006-12-20
** Version: 2.00
** Descriptions: Modified for LPC23XX
**
********************************************************************************************************/
#define IN_TARGET
#include "config.h"
/*********************************************************************************************************
** Function name: IRQ_Exception
**
** Descriptions: interrupt exceptional handler , change it as needed
**
** input parameters: None
** Returned value: None
**
** Used global variables: None
** Calling modules: None
**
** Created by: Chenmingji
** Created Date: 2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void __irq IRQ_Exception(void)
{
while(1); // change it to your code 这一句替换为自己的代码
}
/*********************************************************************************************************
** Function name: FIQ_Exception
**
** Descriptions: Fast interrupt exceptional handler , change it as needed
**
** input parameters: None
** Returned value: None
**
** Used global variables: None
** Calling modules: None
**
** Created by: Chenmingji
** Created Date: 2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void FIQ_Exception(void)
{
while(1); // change it to your code 这一句替换为自己的代码
}
/*********************************************************************************************************
** Function name: TargetInit
**
** Descriptions: Initialize the target board; it is called in a necessary place, change it as
** needed
**
** input parameters: None
** Returned value: None
**
** Used global variables: None
** Calling modules: None
**
** Created by: Chenmingji
** Created Date: 2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by:
** Modified date:
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void TargetInit(void)
{
/* 添加自己的代码 */
/* Add your codes here */
}
/*********************************************************************************************************
** Function name: TargetResetInit
**
** Descriptions: Initialize the target board before running the main() function; User may
** change it as needed, but may not deleted it.
**
** input parameters: None
** Returned value: None
**
** Used global variables: None
** Calling modules: None
**
** Created by: Chenmingji
** Created Date: 2004/02/02
**-------------------------------------------------------------------------------------------------------
** Modified by: zhangrijin
** Modified date: 2007/1/18
** Descriptions: Modified for LPC23XX
**------------------------------------------------------------------------------------------------------
********************************************************************************************************/
void TargetResetInit(void)
{
#ifdef __DEBUG_RAM
MEMMAP = 0x2; // remap
#endif
#ifdef __DEBUG_FLASH
MEMMAP = 0x1; // remap
#endif
#ifdef __IN_CHIP
MEMMAP = 0x1; // remap
#endif
SCS = (SCS & 0x04)|0x20; // Enable the main OSC,,1MHz~20MHz
while((SCS & 0x40) == 0 ); // Wait until main OSC is usable
if ( PLLSTAT & (1 << 25) ) // if the PLL was connected
{
PLLCON = 0x01;
PLLFEED = 0xAA; // disconnect the PLL
PLLFEED = 0x55;
PLLCON = 0x00;
PLLFEED = 0xAA; // disable the PLL
PLLFEED = 0x55;
}
else if ( PLLSTAT & (1 << 24) ) // if the PLL was enabled // 如果PLL已被使能,则先禁止PLL
{
PLLCON = 0x00;
PLLFEED = 0xAA; // disable the PLL
PLLFEED = 0x55;
}
CLKSRCSEL = 0x01; // select main OSC as the PLL clock source
PLLCON = 1; // Enable but disconnect the PLL
PLLCFG = (((PLL_NValue-1) << 16)|(PLL_MValue-1) ); // set the PLLCFG
PLLFEED = 0xAA; // Enable PLL
PLLFEED = 0x55;
while (((PLLSTAT & (1 << 24)) == 0)); // Wait until the PLL is usable
CCLKCFG = (Fcco/Fcclk - 1); // set the CCLKCFG
PLLCON = 3; // connect the PLL
PLLFEED = 0xAA;
PLLFEED = 0x55;
while (((PLLSTAT & (3 << 25))!= (3 << 25))); // Wait until the PLL is connected and locked
#if USE_USB
PCONP |= 0x80000000; // Turn On the USB PCLK
USBCLKCFG = (Fcco/Fusbclk - 1);
#endif
// Set system timers for each component
#if (Fpclk / (Fcclk / 4)) == 1
PCLKSEL0 = 0x00000000; // PCLK is 1/4 CCLK
PCLKSEL1 = 0x00000000;
#else
#if (Fpclk / (Fcclk / 4)) == 2
PCLKSEL0 = 0xAAAAAAAA; // PCLK is 1/2 CCLK
PCLKSEL1 = 0xAAAAAAAA;
#else
PCLKSEL0 = 0x55555555; // PCLK is the same as CCLK
PCLKSEL1 =
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
WDT_error_int.rar (11个子文件)
WDT_error_int.mcp 213KB
src
config.h 4KB
LPC23xx.h 67KB
main.c 3KB
target.h 4KB
target.c 11KB
IRQ.s 3KB
mem_b.scf 2KB
mem_c.scf 1KB
mem_a.scf 1KB
Startup.s 11KB
共 11 条
- 1
资源评论
JaniceLu
- 粉丝: 95
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- 技术资料分享多核处理器构架的高速JPEG解码算法很好的技术资料.zip
- 技术资料分享第24章 性能和资源占用很好的技术资料.zip
- 技术资料分享第23章 LCD驱动API函数很好的技术资料.zip
- 技术资料分享第22章 LCD驱动程序很好的技术资料.zip
- 技术资料分享第21章 高层次配置很好的技术资料.zip
- 技术资料分享第20章 底层配置很好的技术资料.zip
- 技术资料分享第19章 与时间相关的函数很好的技术资料.zip
- 技术资料分享第18章 输入设备很好的技术资料.zip
- 技术资料分享第17章 Shift-JIS支持很好的技术资料.zip
- 技术资料分享第16章 Unicode很好的技术资料.zip
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功