#include "stm8l151g4.h"
#include "led_init.h"
#include "adc_init.h"
typedef unsigned short uint16_t;
main()
{
uint16_t Value;//unsigned int Value;
int i;
adc_init();
while (1)
{
Value = 0;
ADC1_CR1 |=0x01;/*turn on ADC again*/
i = 10;
while(i--);
while(!(0x01&ADC1_SR));// 是否转换完成
ADC1_SR=0xFE; // 转换完成,软件清零
Value = (uint16_t)ADC1_DRH;//(unsigned int)ADC1_DRH;
Value = Value<<8;
Value =((uint16_t)Value|ADC1_DRL);