Build a string – Rockwell Automation Logix5000 Controllers ASCII Strings Programming Manual User Manual

Page 26

Advertising
background image

Chapter 2 Processing ASCII characters

The source is the same string tag as for the FIND instruction.

The quantity values tells the MID instruction how many characters to pull

from the source.

The start value is the same as the Result value from the FIND instruction.

This tells the MID instruction where to start pulling characters from the

Source.

The Destination contains the characters you located.

The following example builds a string that contains two variables. For example, an

operator terminal may require a string that looks like the following:

For more variables, use additional INSERT or CONCAT instructions.

If you must send a floating-point value, use a RTOS instruction in place of

the DTOS instruction.

The final string excludes the termination character. When you send the

string, use an AWA instruction to automatically append the termination

character.

Example:

To trigger a message in a MessageView terminal, the controller sends the terminal a message in this
format: [Ctrl-T] message # \ address [CR]

Important:

When send_msg is on, the rung does the following:

The first DTOS instruction converts the message number to ASCII characters.

The INSERT instruction inserts the message number (in ASCII) after the control character

[Ctrl-T]. (The hex code for Ctrl-T is $14.)

The second DTOS instruction converts the node number of the terminal to ASCII characters.

The CONCAT instruction puts the node number (in ASCII) after the backslash [ \ ] and stores

the final string in msg.

Important:

To send the message, an AWA instruction sends the msg tag and appends the carriage return

[CR].

Build a string

26

Rockwell Automation Publication 1756-PM013D-EN-P - October 2014

Advertising