📄 lvi.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 : lvi.c
** Abstract : This file implements device driver for LVI module.
** APIlib : NEC78K0KX2.lib V1.01 [09 Aug. 2005]
**
** Device : uPD78F0513(44-pin)
**
** Compiler : NEC/CC78K0
**
*******************************************************************************
*/
/*
*******************************************************************************
** Include files
*******************************************************************************
*/
#include "macrodriver.h"
#include "lvi.h"
/*
**-----------------------------------------------------------------------------
**
** Abstract:
** This function initializes the Low-Voltage Detector.
**
** Parameters:
** None
**
** Returns:
** None
**
**-----------------------------------------------------------------------------
*/
void LVI_Init( void )
{
USHORT i;
LVION = 0; /* stop LVI */
LVISEL = 0; /* detect supply voltage (VDD) */
LVIMD = 0; /* internal interrupt mode */
LVIPR = 1; /* low priority level */
LVIIF = 0;
LVIS = LVI_Level0; /* compare with 4.20V */
LVION = 1; /* enable LVI */
for(i=0; i<=100; i++){ /* wait 10 us */
NOP();
}
LVIMK = 0;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -