
DeviceMaster PNIO | UP User Guide
: 2000639 Rev. A
Project Example - 89
Project Example
This section demonstrates how to use a serial device to read and write IO data in
the PLC. The serial device can receive and transmit ASCII string up to 32 bytes.
The serial device uses STX (16#02) and ETX (16#03) to mark the beginning and
end of each ASCII string. This example uses a PNIO-2304 and the serial device is
connected to serial Port 1.
1.
In a new TIA Portal project, add an IO controller and the PNIO-2304.
2.
Insert a serial module to Slot 1.
3.
Insert a 32-byte input submodule and 32-byte output submodule into Slot 1 1
and Slot 1 2, as shown in the figure below.
Reading Input Data
The input submodule has an IO address range 68..103. That’s a total of 36 bytes,
including 4 bytes of sequence number, length, and 32-bytes of data. The input data
can be accessed directly using the IO address. However, in this example we use a
different approach.
1.
Add a data block
Data_block_1
to the project.
2.
Right-click the data block, select
properties
.
3.
Un-check the
Optimized block access
attribute, as shown in the following figure.
Disabling the
Optimized Block Access
insures that the elements of the data
structure that we are going to define will have a fixed address in the block.