Rockwell Automation Publication 1756-RM003N-EN-P - October 2011 605
ASCII Serial Port Instructions (ABL, ACB, ACL, AHL, ARD, ARL, AWA, AWT) Chapter 17
Structured Text
osri_1.InputBit := temp_low;
OSRI(osri_1);
IF (osri_1.OutputBit) THEN
temp_low_write.LEN := 9;
AWT(0,string[2],temp_low_write);
END_IF;
Example 2: When MV_update is set, the AWT instruction sends the characters in MV_msg.
Because the number of characters in MV_msg varies, the rung first moves the
length of the string (MV_msg.LEN) to the Serial Port Control Length of the
AW T instru ctio n (MV_write.LEN). In MV_msg, the $16 counts as one
character. It is the hex code for the Ctrl-V character.
Relay Ladder
Structured Text
osri_1.InputBit := MV_update;
OSRI(osri_1);
IF (osri_1.OutputBit) THEN
MV_write.LEN := Mv_msg.LEN;
AWT(0,MV_msg,MV_write);
END_IF;
MV_update
Move
Source MV_msg.LEN
10
Dest MV_write.LEN
10
MOV
EN
DN
ER
ASCII Write
Channel 0
Source MV_msg
'$161365\8\1$r'
SerialPort Control MV_write
SerialPort Control Length 10
Characters Sent 10
AWT