扩展库使用说明——TM1650(附学习视频)
天问TM1650模块驱动详解学习视频链接: https://pan.baidu.com/s/1RRrX687bgXeLQP25gD5KCg
提取码回贴可见**** Hidden Message *****
1. 硬件概述
https://haohaodada.com/new/bbs/data/attachment/forum/202101/29/133927h3qnp6optjnmt6a5.png
TM1650 是一种带键盘扫描接口的 LED(发光二极管显示器)驱动控制专用电路。内部集成有 MCU 输入输出控制数字接口、数据锁存器、LED 驱动、键盘扫描、辉度调节等电路。TM1650 性能稳定、质 量可靠、抗干扰能力强,可适用于 24 小时长期连续工作的应用场合。
2. 引脚定义
https://haohaodada.com/new/bbs/data/attachment/forum/202101/29/133927ovreeesz4jbjs25s.png
https://haohaodada.com/new/bbs/data/attachment/forum/202101/29/133928ndy61ypk5yk51ydr.png
https://haohaodada.com/new/bbs/data/attachment/forum/202101/29/133928r8n7evebnm877mb5.png
3. 电路原理图
https://haohaodada.com/new/bbs/data/attachment/forum/202101/29/133928izhda0sr6ykdhek2.png
4. 图形化模块
https://haohaodada.com/new/bbs/data/attachment/forum/202101/29/133928f7l17ybwaaz1bab3.png
https://haohaodada.com/new/bbs/data/attachment/forum/202101/29/133928rs3rsanb7np6c4qa.png
示例代码1
https://haohaodada.com/new/bbs/data/attachment/forum/202101/29/133929b2xpspsz22pxljli.png
[*]#define SOFTIIC_SCL P1_5
[*]#define SOFTIIC_SCL_OUT {P1M1|=0x20;P1M0|=0x20;}//P1_5开漏输出
[*]#define SOFTIIC_SDA P1_4
[*]#define SOFTIIC_SDA_IN {P1M1|=0x10;P1M0&=~0x10;}//P1_4高阻输入
[*]#define SOFTIIC_SDA_OUT {P1M1|=0x10;P1M0|=0x10;}//P1_4开漏输出
[*]
[*]#include <STC8HX.h>
[*]uint32 sys_clk = 24000000;//设置PWM、定时器、串口、EEPROM频率参数
[*]#include "mylib/TM1650.h"
[*]
[*]void setup()
[*]{
[*]TM1650_Init();//TM1650初始化
[*]}
[*]
[*]void loop()
[*]{
[*]TM1650_displayNum(1234);
[*]}
[*]
[*]void main(void)
[*]{
[*]setup();
[*]while(1){
[*] loop();
[*]}
[*]}
[*]
[*]
复制代码
示例代码2
https://haohaodada.com/new/bbs/data/attachment/forum/202101/29/133929a11mmkv114er3bw0.png
[*]#define SOFTIIC_SCL P1_5
[*]#define SOFTIIC_SCL_OUT {P1M1|=0x20;P1M0|=0x20;}//P1_5开漏输出
[*]#define SOFTIIC_SDA P1_4
[*]#define SOFTIIC_SDA_IN {P1M1|=0x10;P1M0&=~0x10;}//P1_4高阻输入
[*]#define SOFTIIC_SDA_OUT {P1M1|=0x10;P1M0|=0x10;}//P1_4开漏输出
[*]
[*]#include <STC8HX.h>
[*]uint32 sys_clk = 24000000;//设置PWM、定时器、串口、EEPROM频率参数
[*]#include "mylib/TM1650.h"
[*]#include "lib/delay.h"
[*]
[*]void setup()
[*]{
[*]TM1650_Init();//TM1650初始化
[*]}
[*]void loop()
[*]{
[*]TM1650_displayFloat(1.234);
[*]delay(200);
[*]}
[*]void main(void)
[*]{
[*]setup();
[*]while(1){
[*] loop();
[*]}
[*]}
[*]
复制代码
示例代码3
https://haohaodada.com/new/bbs/data/attachment/forum/202101/29/133929aq57o7om6yynmzn5.png
[*]#define SOFTIIC_SCL P1_5
[*]#define SOFTIIC_SCL_OUT {P1M1|=0x20;P1M0|=0x20;}//P1_5开漏输出
[*]#define SOFTIIC_SDA P1_4
[*]#define SOFTIIC_SDA_IN {P1M1|=0x10;P1M0&=~0x10;}//P1_4高阻输入
[*]#define SOFTIIC_SDA_OUT {P1M1|=0x10;P1M0|=0x10;}//P1_4开漏输出
[*]
[*]#include <STC8HX.h>
[*]uint32 sys_clk = 24000000;//设置PWM、定时器、串口、EEPROM频率参数
[*]#include "mylib/TM1650.h"
[*]#include "lib/delay.h"
[*]
[*]void setup()
[*]{
[*]TM1650_Init();//TM1650初始化
[*]}
[*]
[*]void loop()
[*]{
[*]TM1650_clear();//TM1650清除
[*]TM1650_displayBit(1,2,0);
[*]delay(500);
[*]TM1650_clear();//TM1650清除
[*]TM1650_displayBit(0,1,1);
[*]delay(500);
[*]}
[*]
[*]void main(void)
[*]{
[*]setup();
[*]while(1){
[*] loop();
[*]}
[*]}
[*]
[*]
[*]
复制代码
手册资料:
感谢分享
页:
[1]