简介
这款8位数码管提供红、绿两种颜色选择,提供16级亮度调节,尺寸小巧,提供四种从机地址,有效避免地址冲突,采用I2C通信只需要2个普通IO即可驱动,节约IO资源,不需要MCU扫描,节省MCU资源。
性能描述
- 工作电压:DC 5V
- 工作电流:<130mA
- I2C总线接口
- 16级亮度调节
- 16x8位RAM用于存储显示数据
- 内部 RC 振荡器
- 四种可更改的从机地址
引脚说明
名称 | 功能描述 |
SDA | 数据线 |
SCL | 控制线 |
GND | 电源负极 |
VCC | 电源正极 |
引脚说明
地址修改说明
该数码管背部预留了A0,A1两个数据位的焊盘(断开为0,连接为1),可以通过A0,A1的不同组合来实现四种从机地址(如右图所示)。
数码管地址控制器格式:
MSB | D6 | D5 | D4 | D3 | D2 | D1 | LSB |
1 | 1 | 1 | 0 | 0 | A1 | A0 | R/W |
其中:D3~D7位不可更改,进行写操作时D0位R/W=0,则:
A1 | A0 | 地址 |
0 | 0 | 0xE0 |
0 | 1 | 0xE2 |
1 | 0 | 0xE4 |
1 | 1 | 0xE6 |
I2C通信协议
微处理器的数据通过两线总线接口和数码管驱动芯片通信,在输入数据时当CLK是高电平时,DIN上的信号必须保持不变;只有CLK上的时钟信号为低电平时,DIN上的信号才能改变。数据的输入总是低位在前, 高位在后传输.数据输入的开始条件是CLK为高电平时,DIN由高变低;结束条件是CLK为高时,DIN由低电平变为高电平。符合标准I2C通信协议。
Arduino平台应用
Arduino 连接图
示例代码
/*!
* @file ledPrint.ino
* @brief Display experiment of the digital tube
* @n Experiment phenomenon: The digital tube displays "HALO",and in one second, displays "H.A.L.O.", then show value of the variable val after one second
* @copyright Copyright (c) 2010 DFRobot Co.Ltd (https://www.dfrobot.com)
* @license The MIT License (MIT)
* @author [Actor](wenzheng.wang@dfrobot.com),[TangJie](jie.tang@dfrobot.com)
* @version V1.0.1
* @data 2022-03-21
* @url https://github.com/DFRobot/DFRobot_LedDisplayModule
*/
# include "DFRobot_LedDisplayModule.h"
/**
* DFRobot_LedDisplayModule Constructor
* Parameter &wire Wire
* In default, the IIC address of 8 bits digital tube is 0xE0
* The IIC address of 8 bits digital tube can be changed by combining A1 and A0
* 1 1 1 0 | 0 A1 A0 0
* 1 1 1 0 | 0 0 0 0 0xE0
* 1 1 1 0 | 0 0 1 0 0xE2
* 1 1 1 0 | 0 1 0 0 0xE4
* 0 0 1 0 | 0 1 1 0 0xE6
*/
DFRobot_LedDisplayModule LED(&Wire, 0xE0);
/**
* DFRobot_LedDisplayModule Constructor
* In default, the IIC address of 4 bits digital tube is 0x48
*/
//DFRobot_LedDisplayModule LED(&Wire, 0x48);
void setup()
{
Serial.begin(115200);
/*Wait for the chip to be initialized completely, and then exit*/
while(LED.begin(LED.e8Bit) != 0)
{
Serial.println("Failed to initialize the chip , please confirm the chip connection!");
delay(1000);
}
/**
* Set the display area to 1, 2, 3, 4
* It can show 4 bits, the region of each parameter is 1~4
* Please resend the display value if the display area is changed
*/
LED.setDisplayArea(1,2,3,4);
}
void loop()
{
/**
* Display "HALO"
* At present, it only supports showing the numbers 0 to 9, capital letters A, B, C, D, E, F, H, L, O, P, U and dash-,
* and you can also bring decimal points, such as "0." "9." "A." "-."
*/
LED.print("H","A","L","O");
delay(1000);
LED.print("H.","A.","L.","O.");
delay(1000);
/**
* Show a viriable value
* The viriable could be both integer and decimal
* Here it can be compatible with the sensor return value, such as temperature, humdity and so on
*/
double val = 13.25;
LED.print(val);
delay(1000);
}