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

📄 target.c

📁 彩色LCD资料
💻 C
字号:
/*****************************************************************************
 *   target.c:  Target C file for Philips LPC214x Family Microprocessors
 *
 *   Copyright(C) 2006, Philips Semiconductor
 *   All rights reserved.
 *
 *   History
 *   2005.10.01  ver 1.00    Prelimnary version, first Release
 *
*****************************************************************************/

#include "LPC214x.h"
#include "type.h"
#include "irq.h"
#include "target.h"



void TargetResetInit(void);

/*****************************************************************************
** Function name:		IRQ_Exception
**
** Descriptions:		interrupt exceptional handler , change it as needed
**
** parameters:			None
** Returned value:		None
** 
*****************************************************************************/
void IRQ_Exception(void) __irq
{

    while(1);                   /*  change it to your code */
}

/*****************************************************************************
** Function name:		FIQ_Exception
**
** Descriptions:		Fast interrupt exceptional handler , change it as needed
**
** parameters:			None
** Returned value:		None
**
******************************************************************************/
//void FIQ_Exception(void) __fiq
//{
//    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
**
** parameters:			None
** Returned value:		None
** 
******************************************************************************/
void TargetInit(void)
{
	TargetResetInit();

    /* 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.
**
** parameters:			None
** Returned value:		None
** 
******************************************************************************/
void TargetResetInit(void)
{
#ifdef __DEBUG_RAM    
    MEMMAP = 0x2;                   /* set remap register */
#endif

#ifdef __DEBUG_FLASH    
    MEMMAP = 0x1;                   /* set remap register */
#endif

#ifdef __IN_CHIP    
    MEMMAP = 0x1;                   /* set remap register */
#endif

    /* Set system timers for each component */
    PLL0CON = 1;
#if (Fpclk / (Fcclk / 4)) == 1
    VPBDIV = 0;
#endif
#if (Fpclk / (Fcclk / 4)) == 2
    VPBDIV = 2;
#endif
#if (Fpclk / (Fcclk / 4)) == 4
    VPBDIV = 1;
#endif

#if (Fcco / Fcclk) == 2
    PLLCFG = ((Fcclk / Fosc) - 1) | (0 << 5);
#endif
#if (Fcco / Fcclk) == 4
    PLL0CFG = ((Fcclk / Fosc) - 1) | (1 << 5);
#endif
#if (Fcco / Fcclk) == 8
    PLL0CFG = ((Fcclk / Fosc) - 1) | (2 << 5);
#endif
#if (Fcco / Fcclk) == 16
    PLL0CFG = ((Fcclk / Fosc) - 1) | (3 << 5);
#endif
    PLL0FEED = 0xaa;
    PLL0FEED = 0x55;
    while((PLL0STAT & (1 << 10)) == 0);
    PLL0CON = 3;
    PLL0FEED = 0xaa;
    PLL0FEED = 0x55;
    
    /* Set memory accelerater module*/
    MAMCR = 0;
#if Fcclk < 20000000
    MAMTIM = 1;
#else
#if Fcclk < 40000000
    MAMTIM = 2;
#else
    MAMTIM = 3;
#endif
#endif
    MAMCR = 2;
    
    /* Add your codes here */
    return;
}

/******************************************************************************
**                            End Of File
******************************************************************************/

⌨️ 快捷键说明

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