#include "CH554.H"
#include "Debug.H"
#include "GPIO.H"
#include "HT1621.H"
#include "ADC.H"
#include "stdio.h"
#include
#include
#define uchar unsigned char
#define uint unsigned int
// 0 1 2 3 4 5 6 7 8 9
uchar code tabe1[11] = {0xF0,0x00,0xD0,0x90,0x20,0xB0,0xF0,0x10,0xF0,0xB0};
uchar code tabe2[11] = {0xA0,0xA0,0x60,0xE0,0xE0,0xC0,0xC0,0xA0,0xE0,0xE0};
uchar a0,a1,a2,num;
/*******************************************************************************
* Function Name : Show_Init()
* Description : 显示对应的电压
*******************************************************************************/
void Show_Init(uchar a0,uchar a1,uchar a2)
{
Write_1621(15,tabe1[a0],4);
Write_1621(16,tabe2[a0],4);
Write_1621(17,tabe1[a1],4);
Write_1621(18,tabe2[a1],4);
Write_1621(19,tabe1[a2],4);
Write_1621(20,tabe2[a2],4);
}
void main( )
{
UINT16 i;
ADCInit(0);
EA=1; //开启全局中断
Init_1621(); //初始化HT1621
HT1621_all_off(); //清空LCD显示
while(1)
{
for(i=0;i<4;i++)
{
ADC_ChannelSelect(3); //ADC采样电源开启和通道设置,采样通道AIN3
ADC_START = 1; //开启采样,等待采样完成进入中断
while(ADC_START); //采样完成,ADC_START=0
num=ADC_DATA;
mDelaymS(100); //等待,进入下通道采集数据
}
a0=num/100;
a1=num%100/10;
a2=num%10;
Show_Init(a0,a1,a2);
}
}