📄 adccmd.c
字号:
//----------------------------------------------------------------------------
//
// FILE NAME VERSION
// ADCcmd.c 1.0
//
// DESCRIPTION
// ADC command functions for S3C44B0X
// Use MAX1246 4-QSPI ports
//
// DEPENDENCIES
// ADCdrv.c
//
// HISTORY:
// 2005.12.15 Arthur Zhu Initial begin
// 2005.06.24 Arthur Zhu support bipolar mode
//----------------------------------------------------------------------------
#include "ADClib.h" // Hardware enviroment and function definitions
//----------------------------------------------------------------------------
// Function name : MAX1246_RD_AVG -> ADC_RD_AVG
// Description : 从A/D读值子程序
// Return type : short
// Argument : unsigned int cmd: 命令字 (8-bit)
// Argument : unsigned char times: 次数
//----------------------------------------------------------------------------
short ADC_RD_AVG (unsigned int cmd, unsigned char times)
{
unsigned char i;
int result; // 定义命令字,和数据存储器
result = 0;
for (i = 0; i < times; i++)
{
result += ADC_RD_DAT (cmd); // 读取result once
MAX1246_CSn_NOVALID; // 命令结束, CSn = 1
}
result /= times;
return (result); // 返回键值 12-bit
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -