Data transfer via communication ports
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 area 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.
Offset
0
2
1
1
3
4
2
2n
2n-1
n
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:
Offset
8
0
16#42(B) 16#41(A)
1
16#44(D) 16#43(C)
2
16#46(F) 16#45(E)
3
4
16#48(H) 16#47(G)
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 transmission, 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.
734
Storage area for the number of bytes to be sent
1
Storage area for the data to be sent
2