FUNCTION "FC_GET_PROFINET_DEVICE_STATES" : Void
{ S7_Optimized_Access := 'TRUE' }
VERSION : 0.1
   VAR_TEMP 
      nRetValExist : Int;
      nRetValFaulty : Int;
   END_VAR


BEGIN
	REGION Device States
	    
	    REGION Get MODE Exist 
	        #nRetValExist := DeviceStates(LADDR := "Local~PROFINET_IO-System", // IO-System 
	                                      MODE := 4, // vorhanden / nicht vorhanden
	                                      STATE := "DB_PROFINET_DEVICE_STATES".arPN_DEV_STATE_EXIST); // Status
	    END_REGION
	    
	    REGION Get MODE Fault
	        #nRetValFaulty := DeviceStates(LADDR := "Local~PROFINET_IO-System", // IO-System  
	                                       MODE := 2, // Störung
	                                       STATE := "DB_PROFINET_DEVICE_STATES".arPN_DEV_STATE_FAULTY); // Status 
	    END_REGION
	    
	END_REGION
END_FUNCTION

