uart_temp/ReadMe.md

66 lines
1.8 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# UART_TEMP - 利用单片机获取温度,并通过串口打印、
uart_temp是用于8051单片机上的一个项目用于获取温度并使用串口打印出来。
## 特点
- 支持打印浮点数
- 支持串口打印
- 仅当温度变化时才会打印
- 支持[SDCC](https://sdcc.sourceforge.net/)编译
- 支持[stcgal](https://github.com/grigorig/stcgal)命令行烧录
- 支持不断电烧录,发送"RESET!"命令后,软复位单片机,并自动重启。(`stcgal -a -r "./reset_mcu.sh"`的方式无法自动重启,原因未知)
- 支持Makefile
- 支持Window环境
## 快速开始
请先安装以下工具:
- [SDCC - Small Device C Compiler (sourceforge.net)](https://sdcc.sourceforge.net/)
- [grigorig/stcgal: Open Source STC MCU ISP flash tool (github.com)](https://github.com/grigorig/stcgal)
- [Make - GNU Project - Free Software Foundation](https://www.gnu.org/software/make/)
- [串口调试助手软件(ATK-XCOM) 版本v3.0 — 正点原子资料下载中心 1.0.0 文档](http://47.111.11.73/docs/tool/ruanjian/ATK-XCOM.html)
1. 编译源文件
```bash
make clean all
```
2. 将Makefile中的COM3口修改为本地连接单片机的COM口
3. 烧录到单片机
```bash
make flash
```
4. 打开串口软件,接收来自单片机的数据
串口波特率9600
```bash
minicom -D /dev/ttyUSB0 -b 9600
```
> 推荐使用图形化的串口软件:[COMtool](https://github.com/Neutree/COMTool/tree/master)
5. 运行`process.py`解析数据生成图片
```bash
# 新建虚拟环境
virtualenv env
# 安装依赖
pip install -r requirements.txt
# 运行脚本
python process.py
```
![数据图片](./img.png)
## 更多的信息
[从Keil迁移到SDCC](https://blog.csdn.net/weixin_44681954/article/details/135286404)