Data transfer via communication ports
734
Part III FP Instructions
1. Setting the communication parameters (see)
2. Generating the data in the send buffer
To generate the data in the send buffer, define a variable in the program and copy the data to the send buffer
using a transfer instruction, e.g. F10_BKMV (see page 819).
The storage are
a for the data to be sent starts with the second word of the send buffer (offset 1). Offset 0
contains the number of bytes to be sent.
1
Storage area for the number of bytes to be sent
2
Storage area for the data to be sent
0
1
2
n
Offset
2
1
3
4
2n 2n-1
Bold numbers indicate the order of transmission.
The maximum volume of data that can be sent is 2048 bytes.
EXAMPLE
Define a send buffer for 30 bytes (ARRAY [0...15] OF WORD) and copy 8 characters of a string ("ABCDEFGH")
into the buffer.
Send buffer layout:
0
1
2
4
16#42(B) 16#41(A)
16#44(D) 16#43(C)
16#48(H) 16#47(G)
16#46(F) 16#45(E)
8
3
Offset
15
The first word of the send buffer (offset 0) is reserved for the number of bytes to be sent. Therefore, copy the
data into offset 1 (SendBuffer[1]).
When sending begins (the execution condition for F159_MTRN (see page 741) turns to TRUE), the value in
offset 0 is set to 8. At the end of transmissi
on, the value in offset 0 is automatically reset to 0. The data in offset
1 to offset 4 is sent in order from the low order byte.