ASCII I/O Module Tutorial
Chapter 4
435
data by placing the last character in the lower byte of the last word of the
file.
You can tell the difference between the storage of left and right justified
data by looking at the first and last words. In left justified data, spaces or
fill characters, if needed, are added to the last file word. In right justified
data, spaces or fill characters, if needed, are added to the first word.
If the number of characters transferred using an end-of-string delimiter is
less than the string length that you set in IW2(00-13), the module
completes the string by inserting fill characters or spaces. The fill
characters or spaces are stored ahead of the data (lower numbered storage
words) for right justified data, or following the data (higher numbered
storage words) for left justified data.
In this demonstration you will select an end-of-string delimiter and
demonstrate its use.
You will select the carriage return CR as the end-of-string delimiter and
set IW3(10-16) accordingly. The carriage return is the [ENTER] key on
the industrial terminal keyboard.
The ASCII carriage return is 0D in hex, 0001101 in binary.
1.
Set IW3(10-16) for the end-of-string delimiter CR using the
procedure in section titled “Setting Bits in Initialization Words”, P.
3-4.
Display The initialization word file is displayed in hex and binary,
respectively, as follows:
RADIX = %H START = WO007:0000
WORD #
00000
0
0000
1
0000
2
0002
3
0015
4
0D00
5
0000
6
7
START = WO007:0000
WORD #
00000
2
00000000
0000000
3
00000000
00010101
4
00001101
00000000
. . .
NOTE:
Binary words 0, 1, and 5 were omitted for brevity.
Demonstrating EndofString
Delimiter
StockCheck.com