?? system.c
字號:
/*
*******************************************************************************
**
** This device driver was created by Applilet for the 78K0/KB2, 78K0/KC2,
** 78K0/KD2, 78K0/KE2 and 78K0/KF2 8-Bit Single-Chip Microcontrollers.
**
** Copyright(C) NEC Electronics Corporation 2002 - 2005
** 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 : NEC78K0KX2.lib V1.01 [09 Aug. 2005]
**
** Device : uPD78F0513(44-pin)
**
** Compiler : NEC/CC78K0
**
*******************************************************************************
*/
/*
*******************************************************************************
** Include files
*******************************************************************************
*/
#include "macrodriver.h"
#include "system.h"
/*
*******************************************************************************
** MacroDefine
*******************************************************************************
*/
/*
**-----------------------------------------------------------------------------
**
** Abstract:
** Init the Clock Generator and Oscillation stabilization time.
**
** Parameters:
** None
**
** Returns:
** None
**
**-----------------------------------------------------------------------------
*/
void Clock_Init( void )
{
UCHAR temp_stabset, temp_stabwait;
SetIORBit(PM12, 0x06); /* P121/122 input mode */
ClrIORBit(OSCCTL, 0x80); /* X1/X2 input mode */
SetIORBit(OSCCTL, 0x40);
ClrIORBit(MOC, 0x80);
/* OSC stabilization time */
temp_stabset = CG_X1STAB_STA;
do{
temp_stabwait = OSTC;
temp_stabwait &= temp_stabset;
}while(temp_stabwait != temp_stabset);
OSTS = CG_X1STAB_SEL;
ClrIORBit(OSCCTL, 0x01); /* 2MHz<=fx<=10MHz */
SetIORBit(MCM, 0x05); /* X1 operate for CPU */
SetIORBit(PM12, 0x18); /* P123/124 input mode */
ClrIORBit(OSCCTL, 0x20); /* XT1 input mode */
SetIORBit(OSCCTL, 0x10);
ClrIORBit(RCM, 0x01);
PCC = CG_CPU_CLOCKSEL;
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -