#include <reg51.h>
#include <intrins.h>
#include "get_status.h"
#define uchar unsigned char
#define uint unsigned int
sbit full_led = P3 ^ 0; //充满电
sbit poor_led = P3 ^ 1; //电量不足
sbit yuchong = P3 ^ 2; //预充电状态
sbit henliu = P3 ^ 4; //恒流充电
sbit key1 = P2 ^ 6; //充电
sbit key2 = P2 ^ 7; //断电
bit flag = 1;
void main()
{
while ( 1 )
{
Data_ADC = ADC0804();
/* 启动ADC转换 */
Data_Conv();
/* AD采样后数据转换 */
if ( flag == 1 )
{
if ( Data_Led[0] >= 4 )
{
full_led = 0;
} else {
if ( Data_Led[0] == 0 || Data_Led[0] == 1 || Data_Led[0] == 2 )
{
yuchong = 0;
poor_led = 0;
}