基于单片机电源电压检测指示系统设计(毕业设计资料)
015【毕设课设】基于单片机电源电压检测指示系统设计,实时检测电源电池的电压,通过电压来判断四种状态,包括电池满状态、电池不满状态、预充电状态、恒流充电状态,可以手动充电开关,电源装换模块电路。
【资源下载】下载地址如下:
https://docs.qq.com/doc/DTlRSd01BZXNpRUxl
#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()
{
uint buffer = 0;
while ( 1 )
{
Data_ADC = ADC0804();
/* 启动ADC转换 */
Data_Conv();
/* AD采样后数据转换 */
if ( flag == 1 )
{
buffer = Data_Led[0]*1000+ Data_Led[1]*100+Data_Led[2]*10+Data_Led[3];
if ( buffer > 3300 )
{
full_led = 0;
} else {
if ( buffer > 2500 )