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

📄 testbianhua

📁 这是一个基于nec78f8024的led驱动程序
💻
字号:
#include "testmacrodriver.h"
#include "testANI.h"
#include "testANI_user.h"

/*
**-----------------------------------------------------------------------------
**
**  function name:
**  	ANI0_init
**
**  Parameters:
**  	void
**
**  Returns:
**  	void
**
**-----------------------------------------------------------------------------
*/ 
void testbian_init(void) 
{
	/* case comparator operation disabled */
	if (ADCE == BIT_CLR) {
		/* stops conversion operation */
		ADCS = BIT_CLR;
		/* ADM set initialize value */
		ADM = ADM_INIT_VALUE;
		/* between P20 to P23 are used as analog input port */
		ADPC = ADPC_INIT_VALUE;
	}

	/* port mode of analog input channel 0 is set to the input port */
	PORT_MODE_ANALOG_0 = INPUT;
}

/*
**-----------------------------------------------------------------------------
**
**  function name:
**  	ANI0_getValue
**
**  Parameters:
**  	void
**
**  Returns:
**  	short
**
**-----------------------------------------------------------------------------
*/
short ANI0_getValue(void)
{
	short shRetValue;
	
	/* the analog input channel specified for 0 */
	AD_CONVERT_CHANNEL = 0;
	/* enables conversion operation */
	ADCS = BIT_SET;

	/* wait for the A/D conversion completion */
	while (ADIF == BIT_CLR);

	/* take out the conversion value */
	shRetValue = ADCRH;

	/* disables conversion operation */
	ADCS = BIT_CLR;
	/* clear the A/D conversion interrupt request flag */
	ADIF = BIT_CLR;

	/* return the conversion value */
	return shRetValue;
}


⌨️ 快捷键说明

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