How Can We Help?

Print

How to send text and tags from an ACE PLC to a cheap LCD screen using the RS232 link

 

It is sometimes useful to have the possibility to just display text and tags from a ACE PLC on a cheap LCD display.

Here we will see how to connect an RS232 LCD Display Raylid RSI1602 to a ACE PLC.

For example:

  • to display machine status information
  • display machine’s alarm
  • display the number of products from the PLC’s counter,..

 

First of all, design the template of your 2 lines to be display

In our example, we choose to print this template on you right.

SPEED: ##### rpm
ID: #### WT: ####

For this purpose, built your template on https://convert.town/text-to-ascii

  • Use the “#” character for all your variables that you want to insert in this template.
    • It is important to use a sufficient number of “#” according to your values.
    • Also, don’t tape “Enter” at the end of the line. (Codes 10 or/and 13)

Your ASCII code list on the right should end with you last character and have 1 or more “35” (#) for each digit inside.

Line 1 :

 

Line 2 :

 

Copy your template into a array of values

You have 3 subroutines in the program you can download here: LCD Display via RS232

  • SendTextToDisplay.viofs : Main subroutine which display the template with all of your numbers
  • NumberToASCII.viofs : Convert a number in ASCII code
  • AddValueToString.viofs : Add your values in the array (replace the 35 by the right ASCII codes of your numbers)

You can use this program for your test and then import the 3 subroutines into your machine program.

You must:

  • In the subroutine “SendTextToDisplay”, copy all the ASCII codes to build your template in your ACE machine.
  • If your text is shorter than the array, complet with 32 code (32 > StringToDisplay[17])
    • 32 = space = ‘    ‘
  • then, add this subroutine call “AddValueToString” as many times as there are numbers in the template.

Don’t forget to increment the pointer of the Numbers[x] tag : Numbers[0], Numbers[1], Numbers[2],..

 

 

Start displaying on the LCD display!

Finally, in your main program:

  • Copy yours values/numbers in the MyValues[] array, in the same order as they appeared in your template
    • You can use another name for the array tag MyValues.
  • For start the displaying, just call the subroutine “SendTextToDisplay”
    • RefreshTimeMS sets the refresh time of the display
    • LCDBrightness define the brightness from 0 to 255.