📄 adc_test.c
字号:
#define LPCEB2000_I
/*********************************************************************************************
* File: ADC_test.c
* Author: Embest w.h.xie
* Desc: A/D test
* History:
*********************************************************************************************/
/*------------------------------------------------------------------------------------------*/
/* include files */
/*------------------------------------------------------------------------------------------*/
#include "LPC_api.h"
#include "target.h"
/*********************************************************************************************
* name: Main
* func: main fun
* para: none
* ret: none
* modify:
* comment:
*********************************************************************************************/
int Main(void)
{
uint8 i, j;
uint32 dly, unADCData;
GPIO0_init();
// PLL、MAM init
SYS_Init(FOSC, FCCLK, VPBDIV4, USE_RAM, MAMAuto, NULL);
led_init();
szLedpoint |= 1 << 0;
szLedpoint |= 1 << 4;
dly = 0;
do
{
dly++;
if (dly==100)
{
dly = 0;
ADC_Init(ADCPort1);
unADCData = ADC_GetREGValue_ADDR();
// change (V)
unADCData = unADCData * 3300 / 1024;
for (i=4; i>0 ; i--) {
j = unADCData % 10;
szLedChr[i-1] = j;
unADCData = unADCData / 10;
}
ADC_Init(ADCPort0);
unADCData = ADC_GetREGValue_ADDR();
// change (V)
unADCData = unADCData * 3300 / 1024;
for (i=4; i>0 ; i--) {
j = unADCData % 10;
szLedChr[i+3] = j;
unADCData = unADCData / 10;
}
}
led_brush();
time_dly(1);
} while(1);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -