Communication using function blocks
6.4 Using function blocks for the output of message texts to a printer
PtP coupling and configuration of CP 340
Manual, 04/2011, A5E00369892-03
113
6.4 Using function blocks for the output of message texts to a printer
Introduction
The P_PRINT function block (FB 4) is available to you for outputting message texts to a
printer. The P_PRINT function block (FB 4) sends a process message to the CP 340, for
example. The CP 340 logs the process message on the connected printer.
Message texts "outputting"
The P_PRINT FB sends a message text containing up to four variables to the CP 340. You
configure the message texts using CP 340: Point-to-Point Communication, Parameter
Assignment (see sections " Data transmission with the printer driver (Page 56)" and
"Conversion and Control Statements for
Printer Ou
tput (Page 77)"). For the purpose of data
transmission, the P_PRINT function block is called cyclically, or alternatively, statically
(without conditions) in a time-controlled program.
The pointers (to data blocks) for the format string and the four variables can be reached by
means of the DB_NO and DBB_NO parameters. The pointers must be stored without gaps
and in a specific sequence in the configured data block. This is the pointer DB (see Figure
"Pointer DB").
The transmission of the message text is initiated by a positive edge at the REQ input. The
frame starts with the format string of the message text. This is followed by tags 1 to 4.
Depending on the volume of data involved, a data transmission may run over several calls
(program cycles).
The P_PRINT function block can be called cyclically when the signal state at the R
parameter input is "1". This aborts the transmission to the CP 340 and sets the P_PRINT FB
back to its initial state. Data that has already been received by the CP 340 is still sent to the
communication partner. If the signal state at the R input remains static at "1", this means that
sending of print requests is deactivated.
The LADDR parameter specifies the address of the CP 340 to be addressed.