The PR200 mini PLC from akYtec can display values of BOOL, INT or REAL variables, as well as constant text on its LCD screen, which cannot be said of STRING variables. The data type STRING is not supported by akYtec ALP programming environment. What should be undertaken if there is some variable text to be displayed?

Suppose that a PR200 mini PLC and a TRM202 process controller are connected over the RS485 interface and communicate via Modbus RTU. The goal is to get the TRM202’s firmware version (a string) on the PR200’s display.

According to the TRM202’s User Guide, the ASCII code of the firmware version of the process controller is stored in four sequential Modbus registers, beginning with the register under the address 0x1004 (hex).

Therefore, three steps are required:

  • - read data from the corresponding registers
  • - decode the data
  • - display the data as ASCII symbols on the PR200’s display.

The 4 registers can be read, for example, into 2 INT network variables, two registers per a variable.

Modbus variables

Now these network variables can be processed by the Display Manager of akYtec ALP. But it makes no sense because they are just 32-bit integers that have nothing to do with ASCII symbols. Both variables should therefore be divided into individual bytes. For this purpose, the ASCII_CHAR macro should be used. This macro and its description are available in the Component Manager (akYtec ALP: Main menu > Device > Component Manager).

The ASCII_CHAR has two INT inputs and one INT output. If an INT variable is applied to the first input and the sequence number of the required byte of this variable to the second input, the macro will output an INT value generated from the 8 bits of the corresponding byte.

Since the Version_TRM202_r1 and Version_TRM202_r2 network variables contain 4 bytes each, the ASCII_CHAR macro is to be applied to each of them. As a result, we 8 INT values have been received.

ASCII_CHAR macro Modbus

Each of these INT values is a code that matches a symbol from the ASCII Character Set. It only remains to decode it and show the corresponding symbol on the PR200’s display. This is where the Dynamic Box display element comes into play:

Display element Dynymic Box, akYtec ALP

Dynamic box is used to display one of the text rows from the list depending on the value of the referenced program variable of the type Integer. The Dynamic box display element has three parameters: variable, row list and length.

With the Variable parameter, it is possible to reference to a program variable. The Row list is a table with text rows. In this case, the row list is the ASCII code chart. The Length defines the number of characters that can be displayed.

To display the entire line of the firmware version of the TRM202, 8 Dynamic Box display elements should be used:

Dynamic box, 8 in a row, akYtec ALP

‘The firmware version of the TRM202 on the LCD of the PR200’ ‘The firmware version of the TRM202 on the LCD of the PR200’.