~~NOCACHE~~ ====== lamaPLC: DM56A04 / DM36B06 digital tube display with Modbus Communication ====== |{{:sensor:dm36-dm56_1.png?250|DM56A04 / DM36B06 digital tube display}}|{{:sensor:dm36-dm56_2.png?250|DM56A04 / DM36B06 digital tube display}}|{{:sensor:dm36-dm56_3.png?250|DM56A04 / DM36B06 digital tube display}}| ===== Description ===== * Working voltage: **DC 5 - 28V** * Working current: 4.3 - 42mA //(related to the brightness of the digital tube)// * MODBUS RTU protocol, 03 read command, 06 or 16 write command. * Device address: 1~247, **default 1**, by modifying the 485 address, up to 247 modules can be used in cascade (more than 32, please use RS485 repeater) * Digital tube color: red * Digital tube tube digits: 6 digits 0.36 inches / 4 digits 0.56 inches * Communication interface: [[com:basic_rs485|RS-485]] ([[com:basic_modbus|Modbus RTU]]) * Function: It can display numbers, ASCII characters, letters, floating-point numbers, negative numbers, etc., and the brightness can be adjusted; it supports electronic label function, and the initial display content can be set after power-on * Supported baud rates: 1200 2400 4800 **9600** (default) 19200 38400 57600 115200, ===== Character-set ===== {{:sensor:dm36-dm56_4.png?500|DM56A04 / DM36B06 digital tube display}} {{page>:tarhal}} ===== Modbus Features ===== **Modbus connection characteristics:** \\ Default Modbus settings: 9600 baud, 8N1, RTU communication, slave ID: 1 \\ Function Code: 06/16 control, 03 read status \\ ^Address|Function|R/W| ^0|ASCII code The 1st digit tube displays the contents|R/W| ^1|ASCII code The 2nd digit tube displays the contents|R/W| ^2|ASCII code The 3st digit tube displays the contents|R/W| ^3|ASCII code The 4st digit tube displays the contents|R/W| ^4|ASCII code The 5st digit tube displays the contents|R/W| ^5|ASCII code The 6st digit tube displays the contents|R/W| ^6|Used in combination with register 7 (0x**FFFF**FFFF), cannot be used alone. \\ \\ High 4 bits of the high byte (0x**F**FFFFFFF): \\ 0 indicates a positive number, 1 indicates a negative number \\ Lower 4 bits of the high byte (0xF**F**FFFFFF): \\ specify the number of decimal places, ranging from 0 to 5 \\ \\ Together with register 7, they specify the data to be displayed 0xFF**FFFFFF**) \\ (for data above 65535, three bytes are needed; this byte indicates the highest 8 bits of the data. \\ \\ //Note: This register should be used together with register 7. To write data to these two registers, use the write multiple holding register (16 function code) when displaying data.//|R/W| ^7|Display data. Can be used in combination with register 6 (0xFFFF**FFFF**), or separately. \\ \\ (1) Together with register 6, this register indicates the data to be displayed (the data is represented by 3 bytes, 0xFF**FFFFFF**), the high byte of this register indicates the middle 8 bits of the data (0xFF**FF**FF), and the low byte indicates the lowest 8 bits of the data (0xFFFF**FF**). \\ \\ The **high byte** comes first and the low byte comes second. (0x**FF**FF) \\ \\ //Note: This register is used in conjunction with register 6 to write data to these two registers using the Write Multiple Holding Register (16 function code) when displaying data.// \\ \\ (2) When used independently, write a hexadecimal number into the register, and the digital tube will be converted into a decimal number for display.|R/W| ^8|Blink control register. Each bit represents one digital tube; the lowest bit represents the first digital tube, and so on. \\ **0**: no blinking (default), **1**: Blinking \\ //Note: This parameter is not saved when power is lost.//|R/W| ^9|Digital tube brightness level, **1..8**, 6 digits default 4, 4 digits default 8. \\ //Note: This parameter is saved upon powering down.//|R/W| ^10|Display content is saved. \\ **0**: No saving (default), **1**: Save all digital tube display content \\ //Note: this parameter is saved when powered off.//|R/W| ^11|Digital tube power-on initial display mode setting. \\ **0**: Display "0"; (default), **1**: Display the RS485 address of the module, **2**: Display of saved data. \\ //Note: This parameter is saved at power down.//|R/W| ^251|00: Restore factory settings \\ Telegram: //FF 06 00 FB 00 00 ED E5//|R/W| ^252|Data return delay: 0..25 (* 40 ms); Return data interval time after receiving the command (unit 40 ms)|R/W| ^253|RS485 Address / Slave Address: 1..247, default: 1|R/W| ^254|Baud rate: 0..255; 0:1200, 1:2400 2:4800, **3:9600(default)**, 4:19200, 5:38400, 6:57600, 7:115200, Other: Restore factory settings|R/W| ^255|Parity bit: 0..2; **0 :None(default)**, 1: Even Parity, 2: Odd Parity|R/W| ==== Arduino Required Components ==== To use these displays with an Arduino, you need an RS-485 to TTL converter module (like a MAX485 module) to translate the signals. You'll also use the Modbus library to send commands. * Arduino Board (e.g., Arduino Uno, Nano) * DM56A04 or DM36B06 display (4-digit and 6-digit variants, respectively) * RS-485 to TTL Converter Module (e.g., a board with a MAX485 chip) * External 5V to 24V DC Power Supply for the display module (Arduino's 5V pin may not be enough) * Jumper Wires ==== Wiring Diagram ==== Connect the components as follows, using the Arduino's hardware serial pins (Pin 0/RX and Pin 1/TX): ^Converter Pin^Arduino Pin^Display Pin^Description| ^VCC|5V|VCC|Power for converter (use external supply for display)| ^GND|GND|GND|Ground| ^RO|Pin 0 (RX)|N/A|Receiver Output| ^DI|Pin 1 (TX)|N/A|Driver Input| ^RE & DE|Pin 2|N/A|Receiver/Driver Enable (bridge and connect to one pin)| ^A|N/A|A (RS485A)|RS-485 Differential Signal +| ^B|N/A|B (RS485B)|RS-485 Differential Signal -| Note: The RE and DE pins on the MAX485 module should be connected together and wired to a single digital pin (e.g., Pin 2) to control data direction (send/receive). ==== Required Library ==== Install the **ModbusMaster** library by //Doc Walker// through the Arduino IDE Library Manager. This library simplifies Modbus RTU communication. ==== Arduino Example Code (Modbus RTU) ==== This code uses the ModbusMaster library to send a simple //"display value"// command (Function Code 6) to the display's default address (0x01). #include // Initialize ModbusMaster instance // Use Hardware Serial on pins 0 (RX) and 1 (TX) ModbusMaster node; #define DE_RE_PIN 2 // Pin to control RS-485 direction void setup() { Serial.begin(9600); // Start serial communication node.begin(1, Serial); // Slave ID 1, use the standard Serial port // Set the direction control pin pinMode(DE_RE_PIN, OUTPUT); node.setTransmitBuffer(DE_RE_PIN); // Tell the library which pin controls direction } void loop() { static uint16_t value_to_display = 0; uint8_t result; // Send Modbus command to display the value // Function 0x06 (Write Single Register) // Address 0x0000 (usually the register for the main value) // Value to display result = node.writeSingleRegister(0x0000, value_to_display); if (result == node.ku8MBSuccess) { // Command sent successfully value_to_display++; if (value_to_display > 9999) { // Adjust max value based on 4 or 6 digits value_to_display = 0; } } else { // Handle communication error (optional) // Serial.print("Error: "); // Serial.println(result); } delay(1000); // Update every second } ===== Display, Modbus topics on lamaPLC ===== {{topic>display modbus}} \\ \\ {{tag>DM56A04 DM36B06 eletechsup 7-segment display Modbus RTU Modbus_RTU Arduino}} \\ This page has been accessed for: Today: {{counter|today}}, Until now: {{counter|total}}