?? system.c
字號:
/*
*******************************************************************************
**
** This device driver was created by Applilet2 for 78K0R/Kx3
** 16-Bit Single-Chip Microcontrollers
**
** Copyright(C) NEC Electronics Corporation 2002 - 2008
** All rights reserved by NEC Electronics Corporation.
**
** This program should be used on your own responsibility.
** NEC Electronics Corporation assumes no responsibility for any losses
** incurred by customers or third parties arising from the use of this file.
**
** Filename : System.c
** Abstract : This file implements device driver for System module.
** APIlib : Applilet2 for 78K0R/Kx3 V2.10 [31 Jan. 2007]
**
** Device : uPD78F1166_A0
**
** Compiler : CC78K0R
**
** Creation date: 2008-7-16
**
*******************************************************************************
*/
/*
*******************************************************************************
** Include files
*******************************************************************************
*/
#include "macrodriver.h"
#include "user_define.h"
#include "System.h"
/* Start user code for include definition. Do not edit comment generated here */
/* End user code for include definition. Do not edit comment generated here */
/*
*******************************************************************************
** Global define
*******************************************************************************
*/
/* Start user code for global definition. Do not edit comment generated here */
/* End user code for global definition. Do not edit comment generated here */
/*
**-----------------------------------------------------------------------------
**
** Abstract:
** This function initializes the clock generator.
**
** Parameters:
** None
**
** Returns:
** None
**
**-----------------------------------------------------------------------------
*/
void Clock_Init( void )
{
USHORT i;
/* Set fMX */
UCHAR temp_stabset, temp_stabwait;
OSTS = CG_OSCSTAB_SEL18;
CMC = CG_HISYS_OSC | CG_SYSOSC_OVER10M | CG_SUB_OSC;
MSTOP = 0;
temp_stabset = CG_OSCSTAB_STA18;
do{
temp_stabwait = OSTC;
temp_stabwait &= temp_stabset;
}while(temp_stabwait != temp_stabset);
MCM0 = 1;
/* Set fIH */
HIOSTOP = 1;
/* Set fSUB */
XTSTOP = 0;
/* Software wait 5us */
for(i = 0; i <= CG_SUBWAITTIME; i++){
NOP();
}
/* Set fCLK */
CSS = 0;
CKC &= (UCHAR)~CG_CPUCLK;
CKC |= CG_CPUCLK_MAIN1;
OSMC = CG_FCLK_UNDER10M;
}
/* Start adding user code. Do not edit comment generated here */
/* End user code adding. Do not edit comment generated here */
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -