Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 601
ASCII Serial Port Instructions (ABL, ACB, ACL, AHL, ARD, ARL, AWA, AWT) Chapter 17
Structured Text
IF temp_high THEN
temp_high_write.LEN := 5;
AWA(0,string[1],temp_high_write);
temp_high := 0;
END_IF;
Example 2: When alarm is set, the AWA instruction sends the specified number of characters
in alarm_msg and appends a termination character (s). Because the number of
characters in alarm_msg varies, the rung first moves the length of the string
(alarm_msg.LEN) to the Serial Port Control Length of the AWA instruction
(alarm_write.LEN). In alarm_msg, the $14 counts as one character. It is the hex
code for the Ctrl-T character.
Relay Ladder
Structured Text
osri_1.InputBit := alarm;
OSRI(osri_1);
IF (osri_1.OutputBit) THEN
alarm_write.LEN := alarm_msg.LEN;
AWA(0,alarm_msg,alarm_write);
END_IF;
alarm
Move
Source alarm_msg.LEN
5
Dest alarm_write.LEN
5
MOV
EN
DN
ER
ASCII Write Append
Channel 0
Source alarm_msg
'$1425\1'
SerialPort Control alarm_write
SerialPort Control Length 5
Characters Sent 6
AWA