The article descibed how to add ADIs as INPUT/OUTPUT parameter data in PROFIBUS ,And how to configure to acyclically access those ADIs in TIA Portal(V14).
APPLICABLE PRODUCTS
AB6600、AB6670
PRE-REQUISITES
This article simply introduces how to configure PLC to acyclically access ADIs in PROFIBUS Network using TIA Portal(V14) . More information about this article can refer to user manual :
《Anybus CompactCom 40 - Software Design Guide》
《Anybus CompactCom 40 - Host Application Implementation Guide》
《Anybus CompactCom 40 - PROFIBUS DP Network Guide》
IN THIS ARTICLE
- Define ADIs as parameter data
- Acyclically read out value of ADI
- Acyclically write data into ADI
Define ADIs as parameter data
- Define two variables to store the value of ADI,Data type is UINT16
-
UINT16 ADI_GET_TESTRD;
UINT16 ADI_GET_TESTWR;
-
- Add two ADIs to const AD_AdiEntryType APPL_asAdiEntryList[],ADI number are set 0x55AA,0x55AB
-
/*-------------------------------------------------------------------------------------------------------------
** 1. iInstance | 2. pabName | 3. bDataType | 4. bNumOfElements | 5. bDesc | 6. pxValuePtr | 7. pxValuePropPtr
**--------------------------------------------------------------------------------------------------------------
*/
const AD_AdiEntryType APPL_asAdiEntryList[] =
{
{ 0x1, "OUTPUT", ABP_UINT16, 1, APPL_READ_MAP_WRITE_ACCESS_DESC,{ { &M_Output, &appl_sUint16Prop } } },
{ 0x2, "INPUT", ABP_UINT8, 2, APPL_WRITE_MAP_READ_ACCESS_DESC,{ { &M_Iutput, &appl_sUint8Prop } } },
{ 0x55AA, "ADI_GET_TEST_IR", ABP_UINT16, 1, APPL_NOT_MAP_READ_ACCESS_DESC,{ { &ADI_GET_TESTRD, &appl_sUint16Prop } } },//Input parameter
{ 0x55AB, "ADI_SET_TEST_OW", ABP_UINT16, 1, APPL_NOT_MAP_WRITE_ACCESS_DESC,{ { &ADI_GET_TESTWR, &appl_sUint16Prop } } }//Output parameter
};
-
-
if a ADI as a read only parameter data,Recommand to set the ADI's accessing permission to APPL_NOT_MAP_READ_ACCESS_DESC,if a ADI as a readable and writeable parameter data ,Recommand to set the ADI's accessing permission to APPL_NOT_MAP_WRITE_ACCESS_DESC。Do not add those ADIs to APPL_asAdObjDefaultMap[].
- More information about ADI can refer Chapter 13, Section 4 of《Anybus CompactCom 40 - Software Design Guide》.
Acyclically read out value of ADI
-
PLC can access ADI through PROFIBUS DP-V1 parameter read/write with call services,the module translates the service into standard object requests towards
the Application Data Object(0xFE).
- The data after byte5 is payload of "DP-V1 parameter read/write with call services".
- Call Header: Ext.Funtion no. is 0x08 ,the Subindex should be set to 0x0002 when reading
- ADI Number : in this example ,set to 0x55AA.
- Step1 :The ADI number of what ADI you want to read need to write in Slot 0x00/ Index 0xFF through DP-V1 write command (0x5F) before reaing out value of ADI.
-
Using HMS PROFIBUS Master Simulator as PROFIBUS Master.
-
Chooseing write command(0x5F).
- Slot number 0x00,Index 0xFF.
- Call Header(Ext Function no 0x08 , SubIndex 0x0002),ADI number 0x55AA.
- message log.
-
- Step2 : Using read command(0x5E)read out value of ADI(0x55AA). the value is 0x0005(UINT16).
- the message format of Anybus CompactCom 40 back .
- Using Siemens S7-1200 PLC with CM1243-5 as PROFIBUS DP master read out value of the ADI,the configure steps in TIA portal V14 show as following.
- RDREC and WRREC function block are used to acyclically access ADI .
-
the meaning of RDREC function block parameters.
- ID: Hardware identifier,If in S7-300PLC, ID is Dignostic Address;
- INDEX: fixed to 255(0xFF)
- MLEN: the max length of data in byte;
- RECORD: data store area ;
- LEN: the length of actually reading out data;
- VALID : the flag of sucessful reading;
- ERROR: the flag of reading error.
- the meaning of WRREC function block parameters.
- ID: Hardware identifier,If in S7-300PLC, ID is Dignostic Address;
- INDEX: fixed to 255(0xFF);
- RECORD: data store area ;
- DONE : the flag of sucessful writing;
- ERROR: the flag of writing error.
-
- Add Anybus Compact Com 40 PROFIBUS to PROFIBUS network.
-
Get Anybus CompactCom 40 PROFIBUS‘s hardware identifier.
- Add two data blocks to store data of write command payload and reading out data.
- RDREC and WRREC function block are used to acyclically access ADI .
- Add RDREC and WRREC block to project
- WRREC block settings shown as following.
- WRREC send write commmd to set Slot 0 Index 0xFF to ADI 0x55AA,Enable RDREC function block, Disable WRREC block;
- When reading out value of ADI sucessfully ,Disable RDREC&WRREC blocks.
- RDREC block settings shown as following.
- set value to Write_cfg[],if WR_ADI_REQ is set to TRUE,the program will run and read out value of ADI(0x55AA).
- the data of reading out is stored in Read_cfg[].
Acyclically write data into ADI
- Using HMS PROFIBUS Master Simulator as PROFIBUS Master.
-
Function.no write command(0x5F)
- Slot number 0x00,Index 0xFF
- Call Header(Ext Function no 0x08 , SubIndex 0x0001),ADI number 0x55AB ,Data 0x0708
-
-
message log
-
Using DP-V1 PROFIBUS DP-V1 read command(0x5E) check whether or not sucessful writing
- HMS PROFIBUS Master Simulator :showing as following picture, If status is “Read Ok” ,then writing is sucessful.
- How to configure reading out value of ADI in TIA Portal is shown in section “Acyclically read out value of ADI", To write data into ADI only need to change the value of Write_cfg[].
-
- To Set WR_ADI_REQ to TURE,the program will run and write data into ADI(0x55AB)
-
ADDITIONAL INFO
The example code are for reference only,not as the final functional implementation standard.More information can refer to user manual.
User manual download link: