Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

netXxx_PNSVx_extendedConfig → Components → cifXApplicationDemo → Sources → App_EventHandler.c


3. Configuration packet

In the configuration can be set ptSetConfig->usMaxDiagRecords = 16;

This number need be smaler or same like the value used in the taglist of the firmware

Image Added

In the example only the use of one diagnostic alarm ist demonstrated.

4. Add and Remove Diagnostics service

With the function Add Channel Diagnosis Request() the application can add a diagnosis to the stack. The stack will send an alarm frame to the IO Controler.

The Add Channel Diagnosis Request can be programmed in the AppPNS_DemoApplicationFunctions.c:

...

void AppPNS_HandleAppAddChannelDiagnosisReq( uint16_t usSlot , uint16_t usSubslot, APP_DATA_T* ptAppData)
{
  ...
}


The conformation to this Add diagnostics service has a handle which is needed for remove the diagnostics. It is necessary to save this handle.

The Add Channel Diagnosis Confirmation can be programmed in the AppPNS_DemoApplicationFunctions.c:

...

void AppPNS_HandleAddChannelDiagnosisCnf( APP_DATA_T* ptAppData)
{
  ...
}


With the Handle from the Add diagnostics service it is possbile to remove the diagnostiv from the stack. After

call of remove diagnisis request, the stack sends a Alarm disappears to the controller.

The Remove Channel Diagnosis Request can be programmed in the AppPNS_DemoApplicationFunctions.c:

...

void AppPNS_HandleRemoveDiagnosisReq( APP_DATA_T* ptAppData)
{
  ...
}

...


5. Values from GSDML file

Please add the following colored keywords in the GSDML file:

Note: The diagnostic functions and diagnostic texts can be adapted and changed as required.<ProfileBody>

     <ApplicationProcess>


          <ModuleList>

               <ModuleItem ID="10byteinput" ModuleIdentNumber="0x00000001">

                    <VirtualSubmoduleList>

                         <VirtualSubmoduleItem ID="10byteinput" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00000001">

                              <RecordDataList>

                                   <ParameterRecordDataItem Index="1" Length="2">

                                        <Name TextId="Submodule_10byteinput_ParameterName"/>
                                        <Const Data="0x01,0x01"/>
                                        <Ref ValueItemTarget="ExampleParameter" TextId="IDT_InputExampleParameter1" DataType="Unsigned8" ByteOffset="0" BitOffset="0" DefaultValue="1" AllowedValues="1 2" Changeable="true" />
                                        <Ref ValueItemTarget="ExampleParameter" TextId="IDT_InputExampleParameter2" DataType="Unsigned8" ByteOffset="1" BitOffset="0" DefaultValue="1" AllowedValues="1 2" Changeable="true" />

                                   </ParameterRecordDataItem>

                              </RecordDataList>

                         </VirtualSubmoduleItem>

                    </VirtualSubmoduleList>

               </ModuleItem>

               <ModuleItem ID="6byteoutput" ModuleIdentNumber="0x00000002">

                    <VirtualSubmoduleList>

                         <VirtualSubmoduleItem ID="6byteoutput" MayIssueProcessAlarm="false" SubmoduleIdentNumber="0x00000001">

                              <RecordDataList>

                                   <ParameterRecordDataItem Index="2" Length="2">

                                        <Name TextId="Submodule_6byteoutput_ParameterName"/>
                                        <Const Data="0x02,0x02"/>
                                        <Ref ValueItemTarget="ExampleParameter" TextId="IDT_OutputExampleParameter1" DataType="Unsigned8" ByteOffset="0" BitOffset="0" DefaultValue="2" AllowedValues="1 2" Changeable="true" />
                                        <Ref ValueItemTarget="ExampleParameter" TextId="IDT_OutputExampleParameter2" DataType="Unsigned8" ByteOffset="1" BitOffset="0" DefaultValue="2" AllowedValues="1 2" Changeable="true" />

                                   </ParameterRecordDataItem>

                              </RecordDataList>

                         </VirtualSubmoduleItem>

                    </VirtualSubmoduleList>

               </ModuleItem>

          </ModuleList>

          <ValueList>

               <ValueItem ID="ExampleParameter">

                    <Assignments>

                         <Assign Content="1" TextId="ExampleParameterValue1" />
                         <Assign Content="2" TextId="ExampleParameterValue2" />

                    </Assignments>

               </ValueItem>

          </ValueList>

          <ChannelDiagList>


          <!--User Diagnosis - Example-->

...

                <PrimaryLanguage>

                     ...                     <Text TextId="IDT_OutputExampleParameter1" Value="Output example parameter 1"/>
                     <Text TextId="IDT_OutputExampleParameter2" Value="Output example parameter 2"/>
                     <Text TextId="IDT_InputExampleParameter1" Value="Input example parameter 1"/>
                     <Text TextId="IDT_InputExampleParameter2" Value="Input example parameter 2"/>
                     <Text TextId="ExampleParameterValue1" Value="Parameter 1"/>
                     <Text TextId="ExampleParameterValue2" Value="Parameter 2"/>
                     <Text TextId="Submodule_10byteinput_ParameterName" Value="Example Record for 10 byteinput submodule"/>
                     <Text TextId="Submodule_6byteoutput_ParameterName" Value="Example Record for 6 byteoutput submodule"/>
                     <!--Generic Diagnosis-->
                     <!--#256-->
                     <Text TextId="IDT_DIAG_EXAMPLE" Value="Diagnosis is active" />
                     <Text TextId="IDT_DIAG_HELP_EXAMPLE" Value="Dip 3 in NXHX 90 Board is switched on" />           
         

...

                <Language xml:lang="de">

                     ...
                     <Text TextId="IDT_OutputExampleParameter1" Value="Ausgang Beispiel Parameter 1"/>
                    
<Text TextId="IDT_OutputExampleParameter2" Value="Ausgang Beispiel Parameter 2"/>
                     <Text TextId="IDT_InputExampleParameter1" Value="Eingang Beispiel Parameter 1"/>
                     <Text TextId="IDT_InputExampleParameter2" Value="Eingang Beispiel Parameter 2"/>
                    
<Text TextId="ExampleParameterValue1" Value="Parameter 1"/>
                    
<Text TextId="ExampleParameterValue2" Value="Parameter 2"/>
                    
<Text TextId="Submodule_10byteinput_ParameterName" Value="Beispiel Parameter für 10 byteinput Submodul"/>
                    
<Text TextId="Submodule_6byteoutput_ParameterName" Value="Beispiel Parameter für 6 byteoutput Submodul"/>
                     <!--Generic Diagnosis→
                     <!--#256-->

                    
<Text TextId="IDT_DIAG_EXAMPLE" Value="Diagnose ist aktiv"/>
                    
<Text TextId="IDT_DIAG_HELP_EXAMPLE" Value="Dip 3 im NXHX 90 Board ist eingeschaltet"/>

...

          <ExternalTextList>

     </ApplicationProcess>

</ProfileBody>

7. Event Handler

In this example is the Protocol_EventHandler() used. This function can be found in AppPNS_DemoApplication.c.

The event handler case APP_EVENT_SET_ALARM3 and APP_EVENT_CLEAR_ALARM3 can be triggered with use of the DIP switch


8. Trace

A alarm frame can be found with use of filter pn_rt.frame_id==0xfe01

If the application has implemented diagnostic alarms, than is is easy to produce an alarm.

Diagnostic Alarm.pcap

Image Added

Here a dip switch is used to add an application diagnostic to the Profinet IO Device stack. The device sends an alarm to the PLC. The PLC acknowledge this alarm.

After some seconds the dip switch was changed again to remove from application side the diagnostic from the Profinet IO Device stack. The Devce

sends a Alarm disappears to the controller.

9. Sycon

10. TIA Portal