Format Of Send And Receive Data - Panasonic FP Series Programming Manual

Hide thumbs Also See for FP Series:
Table of Contents

Advertisement

ST
When programming with structured text, enter the following:
if
(DF(bSend))
(* Copy all characters of the SendString to the SendBuffer from position
1 *)
F10_BKMV(s1_Start
(* Send the data of the SendBuffer via the COM Port 2 of the MCU unit
in slot 3 *)
(* In SendBuffer[0] the number of bytes not yet transmitted is stored
*)
F159_MTRN(s_Start
:= 16#0302);
end_if;
Further information:
IsTransmissionDone (see page 763)

22.4.1.1 Format of send and receive data

Remember the following when accessing data in the send and receive buffers:
The format of the data in the send buffer depends on the data type of the transmission data (e.g.
STRING) and on the conversion function used in the PLC program (e.g. F95_ASC (see page 661)).
There is no conversion when data in the send buffer is sent.
The start and end codes specified in the system registers are automatically added to the data sent.
The start code is added at the beginning, the end code at the end of the send string. Do not include
start or end codes in the send string.
The format of the data in the receive buffer depends on the data format used by the external device.
Use a conversion function to convert the data into the desired format, e.g. F27_AHEX.
Start and end codes in the data received are recognized if the corresponding start and end codes
have been specified in the system registers. Start and end codes are not stored in the receive
buffer. The end code serves as a reception done condition, i.e., the "reception done" flag turns to
TRUE when the end code is received. The start code resets the receive buffer.
If "None" is selected for the start code, a start code is not added to the data sent and is not
recognized in the data received. Without start code, the receive buffer can only be reset by
executing F159_MTRN.
If "None" is selected for the end code, an end code is not added to the data sent and is not
recognized in the data received. Without end code, the "reception done" flag does not turn to TRUE.
The end of reception can only be determined by a time-out using the IsReceptionDoneByTimeOut
function or by evaluating the data in the receive buffer.
Different end code settings for sending and receiving
Sometimes you do not want to send an end code, but need an end code in the data received to set the
"reception done" flag to TRUE. In this case, select the desired end code in the system registers and execute
F159_MTRN specifying a negative number for n_Number.
then
:=
Adr_Of_VarOffs(Var
s2_End
:= AdrLast_Of_Var(sSendData),
d_Start
=> awSendBuffer[1]);
:= SendBuffer[0],
Data transfer via communication ports
:= sSendData,
Offs
n_Number
:= LEN(sSendData),
:= 2),
d_Port
745

Advertisement

Table of Contents
loading

Table of Contents