Example 2:
alarm
Move
Source alarm_msg.LEN
Dest
Rockwell Automation Publication 1756-RM003N-EN-P - October 2011
ASCII Serial Port Instructions (ABL, ACB, ACL, AHL, ARD, ARL, AWA, AWT)
Structured Text
IF temp_high THEN
temp_high_write.LEN := 5;
AWA(0,string[1],temp_high_write);
temp_high := 0;
END_IF;
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
MOV
5
alarm_write.LEN
5
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;
AWA
ASCII Write Append
Channel
Source
SerialPort Control
SerialPort Control Length
Characters Sent
Chapter 17
EN
0
alarm_msg
DN
'$1425\1'
alarm_write
ER
5
6
601