How to connect, how to control 8888-Display by RS485/ModBus
|
The display model 8888-Display RS485 ModBus can be controlled through the ModBus RS485 interface as explained below, with classic strings of ModBus bytes. ModBus is a bus widely used for professional applications, and wherever there is an application that uses ModBus and needs a large display, you can place 8888-Display, and it takes very few instructions to display a message or a number (a measurement , a temperature, etc.).
Quick resume, 8888-Display can be controlled with:
RS485 ModBus physical connection
For the RS485 connection the signals A, B must be used, connectable for ex. Dupont connectors printed in the RAW version, available with connector or plug in other versions. In some versions a connector with screw terminals is available with which it is also possible to supply 5V and GND (the maximum absorption of 8888-Display is <1A).
It is then necessary to check that the BAUD speed setting is the same for both your device transmitting on RS485 (PLC, Raspberry, Arduino, Windows PC, Mac, etc.) and for
8888-Display. Any configuration of the 8888-Display baud rate is done by connecting to the internal WiFi (wfeasy.com) + to the internal website (wfeasy.com) and choosing from the drop-down menu.
Commands for ModBus RTU
Generally each Command ModBus in RTU standard binary commands) is a string of bytes that begins with the
address of the Modbus device as the first Byte (the default address of
8888-Display is 01, and can be changed in the WiFi interface) , as the second Byte the
requested function, then continues with other numbers or a text in ASCII characters, and ends with a CRC of two bytes whose calculation is determined by the Modbus standard (we included a button in ControlHUB; in the WiFi interface you can also possibly have 8888-Display ignore the CRC).
We remind you that for the ModBus standard two consecutive ModBus commands must be separated at a time equal to at least 3.5 char (where a char is 11bit; therefore for example at 19200 baud they are 38.5 * 0.052ms = 2ms).
We provide two ways to control the 8888-Display:
the use of registers via the standard 06h (write) and 10h (multi-write) functions, and the
use of the simpler 11h (cmd) function which mimics the operation we have chosen for the
serial commands.
Note that in the "Settings" menu of
8888-Display there are some
utilities that allows you to automatically "calculate" the Hex bytes to be sent for commands 11, 12 and 4 (display/scroll sentences and brightness); you use them with the buttons HA#4 HA#11 and HA#12, they output the hexascii string in a box. Example for "hello" you get 01110B68656C6C6F0A 493A
Function 11h (simplified use of commands)
For convenience, we immediately illustrate the
ModBus 11h function in which all the standard commands of 8888-Display are implemented (as a sub-function) in the same standard we used for the
serial. This system is much more comfortable and faster for the programmer too.
Note that in all examples,
8888-Display is in default configuration with ModBus "slave" device address number 01.
For the 11h function we will send a ModBus frame constructed as follows:
DeviceAddress / 11h / CommandStringaAsForSerial / CRC(l,h)
01 11 \1287BA\n CRC
Shows 87BA on the display.
If we write all in HEX and we calculate the ModBus CRC, the string to be sent by ModBus from your master device to 8888 in order to sho 87BA will be:
01 11 0C 38 37 42 41 0A 3F F8
id fn \12 8 7 B A \n CrcL CrcH
Here we tried with a ModBus USB key from a PC (the key was seen on COM16); as for the hex ascii string (the third box, on the bottom) we obtained it with the Utility in the Service menu (the box with the HA#11 button).
REPLY FOR 11h (when there is a reply)
When there is a reply, the reply is in the format:
DeviceAddress / 11h / 00 / CRC(l,h)
The third byte could be a
error code, that replaces 00.
Example with 8888-Display (id=01) that replies "all right!":
01 11 00 2C 50
id fn 00 CrcL CrcH
COMMANDS FOR 11h (LIKE SERIAL)
Command 12 (#12 o \12)
Shows the string on the display, scrolling if the length of the string is greater than the available characters. Max 250 chars.
Examples:
\128765\n
Shows 8765
\12Hello guys!\n
Shows Hello guys! with automatic continued scrolling
\12@Hello guys!\n
Shows Hello guys! with scrolling, one time
\12Ciao belli\n
(that's 01 11 0C 4369616F 20 62656C6C69 0A FBBD for the device with id=1)
Shows Ciao belli with continued scrolling.
Command 11 (#11 o \11)
It shows the string on the display, scrolling if the length of the string is greater than the available characters, once, then returns to showing what it was previously showing. The string is max 252 characters.
Examples:
\11Hello girls!\n
Shows Hello girls! with scrolling, one time, then come back to the previous display function
Command 2 (#2 o \2)
It shows on the display a timer in seconds.hundredths, starting from the hundredth supplied in input.
Examples:
\20\n
(01 11 02 30 0A 293B x id=1) Starts and displays a timer starting at 00.00
\212\n
(01 11 02 31 32 0A 38D9 x id=1) Starts and displays a timer starting from 00.12
\2s\n
(01 11 02 73 0A 180B x id=1) Stop the timer at the time reached.
\2S1234\n
Stop the timer at 12.34
Command 3 (#3 o \3)
Puts the display in clock mode, setting the time if necessary.
Examples:
\31230\n
(01 11 03 31 32 33 30 0A 9781 x id=1) Starts the clock at 12.30 and displays the clock from now on.
\3n\n
From now on it displays the clock.
Command 4 (#4 o \4)
Set the brightness (or max brightness), the number goes from 0 to 100.
Examples:
\425\n
(01 11 04 32 35 0A CA61 x id=1) Set the brightness (or max brightness) to 25.
\4a\n
Activate automatic brightness control.
\4d\n
Deactivate automatic brightness control.
Command 5 (#5 o \5)
Set the scrolling speed in hundredths of a second (default 25; minimum 5; step 5)
Examples:
\540\n
Set the scrolling to 40 hundredths of a second.
Function 06h (write single register; use for controls)
Recall that as an alternative to 06h you can use the commands in the 11h function.
Note that in all the following examples
8888-Display is in default configuration with ModBus "slave" device address number 01.
REPLY FOR 6h (when there is a reply)
If OK, the response is a repeat of the command you sent, identical.
The normal response is an echo of the query, returned after the contents have been written.
If there is an error the answer is as for function 11h, in the format:
DeviceAddress / 06 / error_code / CRC(l,h)
Command 06h: Register 1
Changes the identifier / slave address of
8888-Display RS485 ModBus from the current value (default is 01) to the value written in Register 1.
Example:
3
01 06 0001 0003 980B
id fn reg1 new-id CRC
We change the ModBus Device Address of 8888-Display to 3.
For this time let's detail:
id: The current Slave Address
fn: The Function Code 6 (Preset Single Register)
reg1: The number of the register to be set, 1
new-id: The value of the new Slave Address we want to write, 3
CRC: The CRC (cyclic redundancy check) for error checking
Command 06h: Register 2
It shows on the display a timer in seconds.hundredths, starting from the hundredth supplied in input.
Examples:
0
01 06 0002 0000 280A
id fn reg2 timer CRC
Starts and displays a timer starting at 00.00
12
01 06 0002 0012 A807
id fn reg2 timer CRC
Starts and displays a timer starting at 00.12
FFFF (this is used as a special value for Stop)
01 06 0002 FFFF 29BA
id fn reg2 stop CRC
Stop the timer at the time reached.
Command 06h: Register 3
Puts the display in clock mode, setting the time.
Examples:
12.30 (in hex è 12=>0C 30=>1E)
01 06 0003 0C 1E FCC2
id fn reg3 hour minute CRC
Starts the clock at 12.30 and displays the clock from now on.
Command 06h: Register 4
Set the brightness (or max brightness in case of variable brightness), usually from 0 to 100
Examples:
18 (that in hex is 12)
01 06 0004 0012 4806
id fn reg3 brightness CRC
Set the brightness (or max if variable) to 18.
FF01..FFFF (value of the multiplier)
01 06 0004 FFxx xxxx
id fn reg3 brightness CRC
Activate automatic brightness control (1 makes the "dark" brighter, 255 less bright)
FF00 (special OFF value)
01 06 0004 FF00 89FB
id fn reg3 brightness CRC
Disable automatic brightness control.
Command 06h: Register 5
Sets the scrolling speed in hundredths of a second (default 25; minimum 5; step 5 even if any number can be set)
Examples:
40 (that in hex is 28)
01 06 0005 0028 99D5
id fn reg3 speed CRC
Set the scrolling to 40 hundredths of a second.
Function 10h (write multiple registers; use only to display numbers and strings)
As an alternative to 10h you can use the Commands of the Function 11th, so 10h could also not be used.
If the Register is 100h the function is the same as for #11.
Since the registers are 16bit the string must be "even"; just add \ n to make an odd string become even, in other words to write "12abc" you will need to send "12abc\n"
Example:
12ABC
01 10 0100 0003 06 31 32 41 42 43 0A DA86
id fn regs len2 len 1 2 A B C \n CRC
It writes on the screen "12ABC" (if the screen is less than 5 characters it will scroll it; once because 100h corresponds to function # 11).
Note that the maximum ModBus Command is 255 bytes, so the max string is 246 bytes (len2 = 123 - 007Bh; len = 246 -F6h)
id: The Slave Address
fn: The Function Code 16 (Preset Multiple Registers, 10 hex = 16 )
regs: The Data Address of the first register for "show string", that must be 100h
len2: Lenght of the string that must be even / 2 (12abc+'\n' -> 6 bytes)
len: Lenght (1 byte)
1 2 a b c \n: The string, we added \n to fill the space and make the string even
CRC: The CRC (cyclic redundancy check) for error checking.
REPLY FOR 10h (when there is a reply)
It is not normally necessary to bother to interpret the answer, however the answer is in the format
DeviceAddress / 10h / 0100 / 0003 / CRC(l,h)
Example with 8888-Display (id = 01) which answers everything OK:
01 10 0100 0003 xx yy
id fn regs regn CrcL CrcH
id: The Slave Address
fn: The Function Code 16 (Preset Multiple Registers, 10 hex = 16 )
regs: The Data Address of the first register 100h
regn: The number of registers written (string lenght/2)
CRC: The CRC (cyclic redundancy check) for error checking.
If there is an error the answer is as for 11h (but with 10h) in the format:
DeviceAddress / 10 / error_code / CRC(l,h)
Error codes:
101 [e] illegal function (only functions 11h, 06h and 10h are available),
102 [f] illegal register address (functions are ok only for certain uses)
103 [g] illegal data value / error using function
104 [h] bad CRC
Here are the quick manuals for some other products:
(C) 2022 VisualVision