Comtrol PROFINET IO User Manual

Page 10

Advertising
background image

10 ­ 2000484 Rev. E

DeviceMaster UP PROFINET IO Installation Quick Start

Example Programs

All that is left is to write the code that copies the input data to the output data. In this example, we have mapped the 

DeviceMaster UP outside the process image, so getting all the data from the input to the output consistently (that is 

all the data in the buffer is from a single IO cycle) we use SFC14 DPRD_DAT as shown below:

The DPRD_DAT function (SFC 14) copies all 132 bytes at address 134 decimal (or 0x86 in Hex) to DB1.DBX0.0. 

Then all this data is copied from DB1 to the output data located at address 608 decimal (or 0x260 in Hex). Note that 

there are 132 bytes being copied is that the full buffer includes a WORD for the sequence number (i.e. a counter 

identifying the sequence of the packet) and a WORD for the amount of data in that buffer (i.e. the maximum amount 

of data is 128 BYTEs, but the actual amount may be less – either way we copy the entire buffer).

Perhaps this will be more clear if we examine some of the memory on the PLC in a running system. Consider the 

following watch window captured from Step7 during system operation.

Having sent two “packets” we can now examine the data to see if we received what we expected. In this case, we 

typed ABCDEFG (followed by an <Enter> key) twice to send the ABCDEFG packet twice. So we can verify the 

following?

We can see that the PLC has received notification that the 3rd packet received (note the sequence number 3 

inline 1 of the window)?

The packet was 8 bytes long (note the length field equals 8 in line 2).?

If we look at the input data in PID 138 and PID 142 we see ABCDEFGH?

We see that the 3rd packet has also been sent back out the output port because the device tells us that it wrote 

packet 3 at input address PIW 600 on line 5.

Advertising