Siemens S7-300 does not come standard with Namur NE43 functionality on analog inputs. For one of our projects we created a block to evaluate sensor status according Namur NE43. In this configuration the SM331 analog input modules is used in 2-wire configuration. And the Namur NE43 capable temperature and pressure transmitters are connected to the analog inputs.

Because the block below is called from the main program, the block need to have a call for every analog input channel. In every call, the input is specified, as well as the range of the transmitter connected. Also the high and low alarm threshold need to be specified. And these figures are taken from a Data-block. The data-block  can be edited by means of the HMI device connected to the PLC. In the block the raw value from the Analog to Digital converter is calculated to a real value. This represents the measured temperature or pressure and is displayed on the HMI device. The alarm values are also specified as real values.

FUNCTION "ANALOG_INPUT" : VOID
TITLE =
//Function for evaluating analog inputs including Namur NE43.
VERSION : 0.1

VAR_INPUT
 Input : WORD ;        //PIW from analog input card
 LowVal : REAL ;       //Low value for range calculation.
 HighVal : REAL ;      //High Value for range calculation
 LowAlarm : REAL ;     //Low alarm threshold
 HighAlarm : REAL ;    //High alarm threshold
 EnableHighAl : BOOL ; //Enable high alarm (Set TRUE to enable)
 EnableLowAl : BOOL ;  //Enable Low alarm bit (Set TRUE to enable)
END_VAR

VAR_OUTPUT
 Value : REAL ;        //Sensor signal in engineering units.
 AlarmHigh : BOOL ;    //High Alarm bit
 AlarmLow : BOOL ;     //Low alarm bit
 Overrange : BOOL ;    //Namur NE43 sensor fault Overrange
 Underrange : BOOL ;   //Namur NE43 sensor fault Underrange
END_VAR

VAR_TEMP
 InReal : REAL ; 
 Range : REAL ; 
 Factor : REAL ; 
END_VAR

BEGIN

NETWORK
TITLE =Namur NE43 low alarm
//Value for evaluation Namur NE43 low = underrange
//3,6 mA = -691 = FD4D
 L #Input; 
 L -691; 
 <I ; 
 = #Underrange;

NETWORK
TITLE =Namur NE43 high alarm
//Value for evaluating Namur NE43 high = overrange
//21,5 mA == 7620 = 30240
 L #Input; 
 L 30240; 
 >I ; 
 = #Overrange;

NETWORK
TITLE = Conversion PeripheralInputWord (PIW) to real
 L #Input;
 ITD ;      //Integer to Double conversion.
 DTR ;      //Double to real conversion
 T #InReal;

NETWORK
TITLE =Calculation of range according high/low engineering units
 L #HighVal; 
 L #LowVal; 
 -R ; 
 T #Range;

NETWORK
TITLE =Calculation of range multiplication factor
//Max input analog is hex 6C00 => 27648 dec
 L #Range; 
 L 2.764800e+004; 
 /R ; 
 T #Factor;

NETWORK
TITLE =Calculation of real value analog input in engineering units
 L #InReal; 
 L #Factor; 
 *R ; 
 L #LowVal; 
 +R ; 
 T #Value; 

NETWORK
TITLE = Low Alarm
 A( ; 
 L #Value; 
 L #LowAlarm; 
 <R ; 
 ) ; 
 A #EnableLowAl; 
 = #AlarmLow; 

NETWORK
TITLE =High Alarm
A( ; 
 L #Value; 
 L #HighAlarm; 
 >R ; 
 ) ; 
 A #EnableHighAl; 
 = #AlarmHigh; 
END_FUNCTION

For testing purposes we are using the DIVIZE A2007E-X 4-20 mA simulator. This unit made testing the configuration really a piece of cake. We dihave completed testing in our workshop with all inputs connected to the 4-20 mA simulators. Because of this test commissioning was fast and flawless.

The code is Step-7 source code, use at your own risc.