Skip to end of banner
Go to start of banner

PNS DeviceName/IP Example

Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 9 Next »

1. Example project

In this example the application shall handle Devicename and IP on application side. For that it is necessary to change the configuration packet, to implement the "save station name indication",

the "save ip address indication" and the "reset to factory indication". For that the application needs a possibility to save information remanent in a flash.

Example Sourcecode can be found in the Extended Config Example: netX 90 - PROFINET IO Device - extendedConfig V2.2.0.0

2. Configuration Packet

In the configuration packet it is necessary to change the ptSetConfig→ulSystemFlags. First step is to disable the flag PNS_IF_SYSTEM_NAME_IP_HANDLING_BY_STACK_ENABLED.

The next step is the use of devicename and ip address parameter in the configuration packet.

The application reads the last remanent saved data from the (application) flash.

ptSetConfig→abNameOfStation = value from flash  (240 signs)

ptSetConfig->ulIpAddr = value from flash  

ptSetConfig->ulGateway = value from flash 

ptSetConfig→ulNetMask = value from flash  

3. Indications

Implement the packet handler Indications for

PNS_IF_SAVE_STATION_NAME_IND

PNS_IF_SAVE_IP_ADDR_IND

PNS_IF_RESET_FACTORY_SETTINGS_IND


Use for example the Ethernet Device Configuration Tool to change the devicename or IP address over the network with the DCP protocol.

https://kb.hilscher.com/display/ETHDEVCFG


The stack forwards this change to the application as an indication. The application now needs to handle the indication.

Check in the indication, if the value shall be saved remanent in the application flash.

if(ptSaveStationNameInd->tData.bRemanent==1)

if(ptSaveIpInd→tData.bRemanent==1)

If the bRemanent value is 1, the application shall check if the value in the application flash is still the same like in the indication. If it is not the same value, write the new value into the application flash.

If the bRemanent value is 0, than your application needs to save the value temporary. That means, the saved value in the application flash needs to be deleted.




  • No labels