Record data

PROFINET record data

PROFINET record data can also be received directly by means of the PLC. To do this an "indication" is set in the PLC ( (READINDICATION for reading and WRITEINDICATION for writing). The RECORD data structure has the following description:

       WORD                 RW;
            #define      PN_READ            0
            #define      PN_WRITE           1
       WORD                 NrOfAR;
       DWORD               API;
       WORD                 Slot;
       WORD                 SubSlot;
       PNIO_RECORD    RecordData;
 

Record Data

       WORD         Index;      
       WORD         Length;                    //zum Lesen auf 0
       WORD         TransferSequence;  
       WORD         LengthOfAligned;

Table of PROFINET RECORD DATA represented on ADS

PROFINET

Length in bytes

Comment

ADS

-

String

AMS NET ID of the PROFINET device

AMSNETID

-

2

0xFFFF
When the virtual interface is used, the port number is to be taken from the System Manager.

Port

Read/Write

2

0 - Read
1 - Write

Read - ReadIndication
Write - WriteIndication

Number of AR

2

0x0000

-

API
Application Process Identifier

4

0x00000000

-

Slot

2

Slot number
0x0000-0x7FFF

IndexOffset High Word

SubSlot

2

SubSlot number
0x0000-0x8FFF

IndexOffset Low Word

Record Data Index

2

0x0000-0x1FFF

IndexGroup Low Word

-

2

0x8000

IndexGroup High Word

Record Data Length

2

to “0” to read

LENGTH

Record Data Transfer Sequence

2

consecutive number

-

Record Data Length of Aligned

2

can be zero

-

Example for reading data; the PROFINET controller wants to read data from a Beckhoff device via the record data. In this example, all the RecIndex values are accepted, and will return the same data - 10 bytes that are located in the "Data" data array.

CASE i OF
0:   ADSREADIND(
        CLEAR:=FALSE ,
        VALID=> ,
        NETID=> ,
        PORT=> ,
        INVOKEID=> ,
        IDXGRP=> ,
        IDXOFFS=> ,
        LENGTH=> );
    IF ADSREADIND.VALID THEN
       IdxGroup:=ADSREADIND.IDXGRP;
       IdxOffset:=ADSREADIND.IDXOFFS ;
        i:=10;
        END_IF
10: ADSREADRES(
        NETID:=ADSREADIND.NETID,
        PORT:=ADSREADIND.PORT,
        INVOKEID:=ADSREADIND.INVOKEID ,
        RESULT:=0 ,
        LEN:=10 ,
        DATAADDR:=ADR(Data),
        RESPOND:=TRUE );
        i:=20;
    ADSREADIND(CLEAR:=TRUE);
20: i:=0;
    ADSREADRES(RESPOND:=FALSE);
END_CASE