当前位置:网站首页>带低压报警的51单片机太阳能充电宝设计与制作(完整代码资料)
带低压报警的51单片机太阳能充电宝设计与制作(完整代码资料)
2022-04-23 06:14:00 【锦官城外w】
本设使用太阳能电池板不定时自供电给锂电池,同时加入51单片机通过adc0809芯片解析锂电池电源,并能进行低压报警,支持两路5V1A同时放电,增加三个按键,支持菜单切换显示等功能。以及相关设计所用的模块资料。
所用模块:
STC89C51单片机最小系统
1602LCD
ADC0809模数转换芯片
DC-DC升压芯片
太阳能板
锂电池充放电管理模块
3.7V锂电池(1S)
实物图:
太阳能充电模块:


升压模块:

void Hardware_Init(void)
{
TMOD=0x02; //设定定时器 T0工作方式
TH0=216; //利用T0中断产生CLK信号
TL0=216;
TR0=1; //启动定时器T0
ET0=1; //配置adc0809
STR=0;
OE=0;
EA=1; //开总中断
delayms(50);
LcdInit(); //lcd初始化
for(i=0;i<14;i++)LcdWriteData(welcome[i]);
led_warn(); //小灯报警
delayms(100);
LcdWriteCom(0x01); //清屏
for(i=0;i<12;i++)LcdWriteData(instruction1[i]);
LcdWriteCom(0x40+0x80);
for(i=0;i<9;i++)LcdWriteData(instruction2[i]);
LED=1;
delayms(100);
}
/******************************************************************************* 函数名: key_scan() 功 能: 按键扫描函数 *******************************************************************************/
uint update=0;
void key_scan(void)
{
if(KEY1==0)
{
delayms(5);
if(KEY1==0)
{
while(KEY1==0);
LcdWriteCom(0x01);
for(i=0;i<15;i++)LcdWriteData(I_Disp[i]);
update=1; //开启实时更新标志位,主函数内更新
}
}
if(KEY2==0)
{
delayms(5);
if(KEY2==0)
{
while(KEY2==0);
LcdWriteCom(0x01);
update=0; //关闭实时更新标志位
LcdWriteCom(0x80);
for(i=0;i<12;i++)LcdWriteData(instruction1[i]);
LcdWriteCom(0x40+0x80);
for(i=0;i<9;i++)LcdWriteData(instruction2[i]);
}
}
if(KEY3==0)
{
delayms(5);
if(KEY3==0)
{
while(KEY3==0); //可增加额外任务
LED=!LED;
}
}
}
/******************************************************************************* 函数名: battery_check() 功 能: 电池检测及报警函数 *******************************************************************************/
void battery_check(void)
{
AD(); //adc数据解析
if(update)
{
LcdDisplay();
delayms(4); //建议加延时,否则小数点后两位变化过快看不清
}
if(KEY1&&KEY2&&KEY3) //由于按键引脚和adc引脚分时复用,所以当按键使用引脚时,停止adc使用
{
//否则adc数据不准确,将影响报警准确度
if(disbuff[0]<=3&&disbuff[1]<=2)led_warn();//警报功能,预设3.2V
}
}
/******************************************************************************* 函数名: main() 功 能: 主函数 注 意: 主函数内由于加入延时,因此按键扫描需稍长时间按下才可有反应(非中断式按键触发) *******************************************************************************/
void main(void)
{
Hardware_Init(); //系统初始化
while(1)
{
key_scan(); //按键扫描
battery_check(); //电压检测显示、报警
}
}
本贴为原创!
时间:2021/01/
祝好!
版权声明
本文为[锦官城外w]所创,转载请带上原文链接,感谢
https://blog.csdn.net/qq_41740659/article/details/112306309
边栏推荐
- torch.mm() torch.sparse.mm() torch.bmm() torch.mul() torch.matmul()的区别
- Infrared sensor control switch
- ECDSA 签名验证原理及C语言实现
- 【点云系列】DeepMapping: Unsupervised Map Estimation From Multiple Point Clouds
- Chapter 3 pytoch neural network toolbox
- torch_ Geometric learning 1, messagepassing
- 【指标】Precision、Recall
- Machine learning notes 1: learning ideas
- 【动态规划】最长递增子序列
- AUTOSAR从入门到精通100讲(八十四)-UDS之时间参数总结篇
猜你喜欢
![[Point Cloud Series] SG - Gan: Adversarial Self - attachment GCN for Point Cloud Topological parts Generation](/img/1d/92aa044130d8bd86b9ea6c57dc8305.png)
[Point Cloud Series] SG - Gan: Adversarial Self - attachment GCN for Point Cloud Topological parts Generation

PyMySQL连接数据库

Wechat applet uses wxml2canvas plug-in to generate some problem records of pictures

Device Tree 详解

【点云系列】SG-GAN: Adversarial Self-Attention GCN for Point Cloud Topological Parts Generation

第5 章 机器学习基础

AMBA协议学习小记

Chapter 1 numpy Foundation

Pymysql connection database

【点云系列】Learning Representations and Generative Models for 3D pointclouds
随机推荐
ECDSA 签名验证原理及C语言实现
Android exposed components - ignored component security
pth 转 onnx 时出现的 gather、unsqueeze 等算子
【点云系列】Unsupervised Multi-Task Feature Learning on Point Clouds
【技术规范】:如何写好技术文档?
多机多卡训练时的错误
. net encountered failed to decode downloaded font while loading font:
使用 trt 的int8 量化和推断 onnx 模型
Chapter 4 pytoch data processing toolbox
Pytorch模型保存与加载(示例)
AUTOSAR从入门到精通100讲(八十六)-UDS服务基础篇之2F
Infrared sensor control switch
imx6ull-qemu 裸机教程1:GPIO,IOMUX,I2C
Gephi tutorial [1] installation
torch_geometric学习一,MessagePassing
第2章 Pytorch基础2
Thanos. SH kill bully script, easily delete half of the files in the system at random
MySQL数据库安装与配置详解
FATFS FAT32学习小记
免费使用OriginPro学习版