Configuring 750-450 Module in Codesys 3.5

Hi,
Here is an example for a 451:

VAR
	
	usiChannel_451						: USINT (1..WagoSysModule_750_451.WagoTypesModule_750_451.MAX_CHANNEL_451) := 1;
	xGetRawChannelConfiguration_451		: BOOL := TRUE;
	utRawChannelConfiguration_451		: WagoSysModule_750_451.WagoTypesModule_750_451.typRawChannelConfiguration;	// here also an array can be defined to configure the channels differently if necessary
	ogetError_451						: WagoSysModule_750_451.WagoSysErrorBase.FbResult;
	xSetRawChannelConfiguration_451		: BOOL;
	osetError_451						: WagoSysModule_750_451.WagoSysErrorBase.FbResult;
	osetstatus_451						: ARRAY[1..WagoTypesModule_750_451.MAX_CHANNEL_451] OF WagoSysErrorBase.FbResult;
	ogetstatus_451						: ARRAY[1..WagoTypesModule_750_451.MAX_CHANNEL_451] OF WagoSysErrorBase.FbResult;
	eServiceState_451_Get 				: WagoSysModule_750_451.WagoTypesModuleBase.eServiceState;
	eServiceState_451_Set				: WagoSysModule_750_451.WagoTypesModuleBase.eServiceState;
	mySensorType						: WagoTypesModule_750_451.eSensorType := WagoTypesModule_750_451.eSensorType.Pt1000_EN60751_01;
	xError								: BOOL;
	xInit_451							: BOOL;
END_VAR

IF NOT xInit_451 AND NOT xError THEN
		
	eServiceState_451_Get := _750_451_16.GetRawChannelConfiguration(		
												usiChannel:= usiChannel_451, 
												xTrigger:= xGetRawChannelConfiguration_451, 
												utRawChannelConfiguration:= utRawChannelConfiguration_451, 
												xError=> xError, 
												oError=> ogetError_451);
	
	CASE eServiceState_451_Get  OF
			WagoTypesModuleBase.eServiceState.DONE : // OK
			
						
					xSetRawChannelConfiguration_451 := TRUE; // trigger write                           
	                                                            
					utRawChannelConfiguration_451.Settings.eSensorType:= mySensorType;    //Change sensor type                  
				(*	....
						 process here your utRawChannelConfiguration 
				    	 possibly also with an array if the 		
					    channels are TO be set differently. *)
			
			WagoTypesModuleBase.eServiceState.ABORT : // Error
				// process here your error handling -> see oError for more information
				ogetstatus_451[usiChannel_451] := ogetError_451;
				xError := TRUE;
																															
	END_CASE
	
	eServiceState_451_Set := _750_451_16.SetRawChannelConfiguration(		
												usiChannel:= usiChannel_451, 
												xTrigger:= xSetRawChannelConfiguration_451, 
												utRawChannelConfiguration:= utRawChannelConfiguration_451, 
												xError=> xError, 
												oError=> osetError_451);
	
	CASE eServiceState_451_Set OF
		
			WagoTypesModuleBase.eServiceState.DONE : // OK -> new configuration is written
				xGetRawChannelConfiguration_451 := TRUE;
				osetstatus_451[usiChannel_451] := osetError_451;
				usiChannel_451 := usiChannel_451 + 1;
			WagoTypesModuleBase.eServiceState.ABORT : // Error -> not able to write -> see oError
				// process here your error handling for write -> see oError for more information
				osetstatus_451[usiChannel_451] := osetError_451;
				xError := TRUE;
				
	END_CASE
		// all modules changed?
	IF usiChannel_451 > WagoSysModule_750_451.WagoTypesModule_750_451.MAX_CHANNEL_451 THEN
		xInit_451 := TRUE;
	END_IF	
END_IF
3 Likes