Send characters to the device – Rockwell Automation Logix5000 Controllers ASCII Strings Programming Manual User Manual

Page 15

Advertising
background image

Communicating with an ASCII device Chapter 1

In the following example, the device sends a variable number of characters, such as

a message or display terminal.

Example:

Continuously test the buffer for a message.

Because each message ends in a carriage return ($0D), the carriage return is configured as the termination character in the

Controller Properties dialog box, User Protocol tab.

When the ABL finds a carriage return, its sets the FD bit.

When the ABL instruction finds the carriage return (MV_line.FD is set), the controller removes the characters from the buffer, up to and

including the carriage return, and places them in the MV_msg tag.

When you send characters to the device, you must determine either to send the

same number of characters each time or to append terminations characters to the

data.

In the following example, you always send the same number of characters and

want to automatically append one or two characters to the end of the data.

Example:

When the temperature exceeds the high limit (temp_high is on), the AWA instruction sends five

characters from the string[1] tag to a MessageView terminal.

The $14 counts as one character. The hex code for the Ctrl-T character.

The instruction also sends (appends) the characters defined in the user protocol. In this example,

the AWA instruction sends a carriage return ($0D), which marks the end of the message.

And then to always send the same number of characters:

Send characters to the
device

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

15

Advertising