MDS-100 - The Networkable Serial LCD Message Display
(mainly used for T100MX PLC, may be used with T100MD for multiple display)
Connecting COMM3 to MDS100
Modern machines often demand good man-machine interface. A message display system is an indispensable part of the man-machine interface and is becoming an essential part of modern control systems. The MDS-100 is specially designed to work with the T100MX PLC to provide a low cost solution for displaying alphanumeric characters on a 4 lines x 20 characters, high contrast, bright back-lit LCD screen. Although all T100MD+ PLCs have a built-in LCD port, it can still utilize the MDS100 for additional display job, especially at a long distance and away from the machine.
MDS-100 comprises a daughter board (the “control board”) that is plugged onto the back (“piggy-backed”) of an industry standard 4x20 LCD module. The control board may be removed during installation of the LCD module but care must be taken to plug it back with all the pins correctly aligned before turning on the power, otherwise the LCD panel and/or the control board may be severly damaged.
Jumper J1 (Baud Rate) J2 (Power Supply) Open 38400 bps 24V Short 9600 bps 12V
Messages to be displayed on the LCD are sent from the PLC to the MDS-100 via their respective RS485 ports at either 38,400 or 9,600 bits per second, selected by the setting of Jumper J1 when power-on (see table). Always use the maximum baud rate (38,400bps for T100MX) for best performance. For short distances of less than 2m, any ordinary pair of cables can be used to connect the RS485 interfaces. Make sure that the “+” and “-” terminals of both RS485 terminals are correctly connected to each other.
For longer distances (of up to 1200m) you need to purchase network-grade shielded twisted-pair cables to connect the MDS100 to the T100MX PLC.
2. Power Supply and Backlighting of MDS100
MDS100 may be powered by the same 12 to 24V DC power supplies of the PLC. The requirements of the backlight current however restrict the working voltage range. MDS100 employs the PWM technique to control the amount of backlight current. When Jumper J2 is open during power-on, the PWM duty cycle is set to 10%. When jumper J2 is shorted, the PWM duty cycle is set to 25%. It is recommended that you leave J2 open for DC24V power supply and short it for DC12V. If you short J2 when using DC24V, the LCD backlight is much brighter (good for outdoor use) but more heat is also being generated on the MDS control board.
One remarkable feature of MDS100 is that you can adjust the brightness of the backlight by software, or even turn it OFF completely using special instruction “?Bnn” described later. This opens up the possibility of using the backlight as a kind of “attention” signal to the operator to read the message when something is amiss or when operator attention is required. When everything works well the backlight is turned off automatically.
3. Displaying Messages
When power is supplied to the MDS100, its backlight should be turned-on and its LCD screen should display a sign-on message announcing its model number for about one second. After that the screen will be cleared and the MDS100 is ready to display messages. A blinking cursor will appear at the top left corner of the screen and the cursor marks the starting position where messages will be displayed.
It is extremely easy to display any character on the LCD. Since the MDS100 is connected to the T100MX PLC's RS485 port, simply use the “PRINT #3” statement to display a string of alphanumeric or special characters on the LCD screen. Texts are displayed beginning at the default cursor position and extend towards the right end of the LCD screen. E.g.
PRINT#3 “Room Temp=”;ADC(1)/100; CHR$(&HDF); “C”
If Analog Digital Converter #1 returns a value of 1200, then in the above example the LCD will display the message:
Room Temp=12 o C
To display the special “degree” ( 0 ) character, please refer to the LCD ASCII table (see Figure 1.25) and you will find that the special character DF (Hex) or 223 (Dec)of the ASCII table corresponds to this symbol. You will need to use CHR$(&HDF) or CHR$(223) to represent this character.
Only as many characters which can be fitted on a single line will be displayed. Excess characters from the PRINT statement will simply be ignored. MDS-100 can accept no more than 20 characters from the PLC at any one time. After displaying the string, the cursor is placed back to the original position. That is to say, messages sent to the MDS100 will always be printed at exactly the same coordinates until being changed by the “?Pxxyy...” command which will be described next.
Displaying Messages Using NETCMD$ command
Since MDS100 is a stand alone electronics device connected to the T100MX PLC via RS485 communication interface, communication errors can occur due to a number of factors and this can result in lost characters or characters being displayed at wrong location. The Network MDS can accept messages embedded within a "host link command" sent to it in a form similar to the PLC’s host link command protocols. Such message format contains error checking "Frame Check Sequence" (FCS) characters which allow the display controller to check whether every character has been properly received. T100MX and T100MD have built-in networking command "NETCMD$" which can facilitates such communication. Use of the NETCMD$ can also avoid over-run of the MDS100 serial buffer which can lead to garbled display.
To use the NETCMD$, first note down the ID address of the MDS100 in use. The ID is displayed in hexadecimal notation (00 to FF) on the 4th line of the sign on message when the MDS100 is first powered ON. Simply append the string "@nn" (where nn is the ID) in front of the coordinates and message string to be displayed. Then create a custom function (e.g. function #99, assuming ID = F0) which can be called by other functions, as follow:
The string to be displayed, including the coordinates "?Pxxyy" are constructed within the caller function as X$ and then passed to function #99 by executing a "CALL 99" command. Function #99 will then add the network header "@F0" (where ID = F0 in this example) to the string and invoke the NETCMD$ to send out the complete network message string (with FCS appended) to the MDS100. When a good message has been received by MDS100 controller the actual content of the message will be extracted and displayed on the LCD. A response string which includes the ‘@’ symbol, the ID and the FCS will be returned to the PLC as acknowledgment via A$. If there are any missing characters then the message will be aborted and NETCMD$ will receive an empty string (hence its length = 0). If an error occur the message will be re-sent a second time by function #99.
E.g. To display a message such as the current room temperature, do the following:
X$= "?P0103Room Temp=" + STR$(ADC(1)/100)+CHR$(&HDF)+"C"
4. Changing Display Coordinates
The command string:
“?Pxxyy<message to be displayed>”
allows you to print the message at the specific coordinates (xx,yy), where xx specifies the column # (01 to 20) and yy specifies the row # (01 to 04). The message to be displayed may follow next. This command changes the default cursor coordinates to the new coordinates (xx,yy) and display the string. E.g. the statement
PRINT #3 “?P0502Col 5; Line 2”
will display the text string “Col5; Line 2” at the coordinates (05,02). Thereafter, any text string sent to MDS100 without the “?Pxxyy” prefix will be displayed starting from the 5th column, 2nd row of the LCD screen.
If you need to display a number that may vary within a range of digits (e.g. it could range from 1 to 1000), you should insert some blank-spaces at the end of the message strings. This will erase the characters occupied by the previous message which could display more digit then the current message. e.g.
PRINT #3 “A = ”;A; “ ”
5. Special Instructions for MDS100
A string sent to MDS100 which begins with the question mark “?” will be treated as special instruction for the MDS100 and will not be printed. The following table describe the various instructions for manipulating the MDS100 display:
Instruction String Action ?C Clear screen ?Pxxyy Change cursor position: xx = 01 to 20 (Column #)
yy = 01 to 04 (row #)
E.g. “?P1403” puts the cursor at 14th position on the 3rd line.
?0 Turn OFF cursor ?1 Turn ON an underline cursor ?2 Turn ON a blinking block cursor ?3 Turn ON both underline and blinking block cursors ?Ixx Send an 8-bit data represented by the hexadecimal number “xx” to the “IR” register of the LCD module* ?Dxx Send an 8-bit data represented by the hexadecimal number “xx” to the “DR” register of the LCD module* ?Bnn Adjust %duty cycle of backlight current. nn = 00 to 25
00 = no backlight. 25 = brightest.
?r Enable the MDS100 to send back an “OK” response after receiving a message or instruction. You will rarely ever need to use this instruction except for testing whether the LCD's RS485 interface is working properly. ?ir ID-Read: returns the current network ID of the MDS100 as a 2-digit hexadecimal string. ?iwxx ID Write:You can use this command to change the network ID of the MDS100 to hex value "xx".
* The LCD module is an industry standard display based on Hitachi HD44780 display controller and special characters may be created by sending instructions to its IR and DR registers. However, the process can be rather tedious and demands skillful programming. Documentation for these instructions may be obtained separately from the LCD module manufacturer.
MDS100 contains a microcomputer which accepts serial characters from the T100MX PLC at 38,400 bits per second. However, due to the slower interface of the LCD module, displaying characters on the LCD module is much slower than the serial communication speed. To avoid losing characters the MDS100's microcomputer stores any incoming characters into a 90 bytes FIFO buffer and then slowly translates them into control signals to activate the LCD display. The queue is shortened as and when a character is being delivered to the LCD module.
The 90 bytes buffer is adequate for most applications, unless you have issued many positioning instructions (using the “?Pxxyy” command) within one CusFn. If more than 90 characters are being sent continuously to MDS-100, some characters in the FIFO buffer may be lost. If you experience lost-characters, then try to insert a delay in between messages to give MDS100 time to display the messages and clear up the buffers. Time delay can be provided using a timer and separate the messages into two CusFn to be activated at different times. You may also use a FOR..NEXT delay loop (not recommended because it waste unnecessary CPU time in idle loop)..
6. MDS100 in the PLC Network
More than one MDS100 can be multi-dropped on the RS485 network as long as each MDS100 is programmed with a different ID address. This opens up great possibility for sophisticated controls where remote LCDs can be sprinkled over a distributed network of control elements. You can use the TRiLOGI program: "CFG-MDS.PC4" supplied on the latest version of TRiLOGI (or download it from: http://www.tri-plc.com/trilogi/cfg-mds.zip") to change the default ID of the Network MDS100. Simply assign the desired ID to variable A in Fn#10 and then transfer the "CFG-MDS.PC4" file into a T100MX+ or MD+ PLC which is connected to the MDS100. Then toggle the "SetID" input momentarily using on-line monitoring mode to write the new ID into the MDS100. If successful the MDS100 will display the new ID address, otherwise you will be asked to retry.
ASCII Symbol Table for MDS100