Calib_Step1_ClearParameters

Overview

The Calib_Step1_ClearParameters function block performs the first step of the AI module calibration procedure. This step clears the currently loaded calibration parameters for the individually selected mode of a specific channel, ensuring that subsequent calibration steps are performed with clean and accurate baseline data.

💡 Step Sequence

After clearing parameters in this first step, the second step needs to be executed, in order to calculate and store the new set of calibration parameters.

Module_ID               :=  (USINT)
Channel_Number          :=  (USINT)
Channel_Mode            :=  (BOOL)
CMD_Clear_Parameters    :=  (BOOL)
STS_Done                =>  (BOOL)
STS_Failed              =>  (BOOL)
STS_Fault_Code          =>  (USINT)

Interface

Inputs

NameTypeRange / UnitsDescription
Module_IDUSINT1 - 15Unique identifier of the AI module.
Channel_NumberUSINT0 - 3Specifies which AI channel to clear.
Channel_ModeBOOL0 / 1Channel mode for which the clearing is done: 1 = 0-10 V, 0 = 4-20 mA.
CMD_Clear_ParametersBOOLTRUE / FALSEClears parameters on a rising edge (input goes from FALSE to TRUE).

Outputs

NameTypeDescription
STS_DoneBOOLTRUE if the calibration parameters have been successfully cleared.
STS_FailedBOOLTRUE if the operation failed to clear the parameters.
STS_Fault_CodeUSINTDiagnostic code indicating the reason for failure.

Fault Codes

CodeMeaningDescription
91Step1 Clear FailedClearing of calibration parameters failed.
97Module FaultedThe AI module reported an internal fault.
98Module MismatchThe detected module type does not match the expected AI module.
99Module Not FoundThe specified Module_ID is not part of the current hardware configuration.

Example

PROGRAM PROG_AI_Calib_Step1_ClearParameters
    VAR
        AI_Calib_Step1 : Calib_Step1_ClearParameters;
        Trigger_Tag    : BOOL := FALSE;  (* Internal toggling trigger *) 
    END_VAR

    AI_Calib_Step1(
        Module_ID := 4,
        Channel_Number := 0,       (* Channel 0 *)
        Channel_Mode := 0,         (* 4-20mA mode *)
        CMD_Clear_Parameters := Trigger_Tag
    );
END_PROGRAM

CONFIGURATION Config0
    RESOURCE Res0 ON PLC
        TASK task1_20ms(INTERVAL := T#20ms, PRIORITY := 1);
        PROGRAM Prog_Instance WITH task1_20ms : PROG_AI_Calib_Step1_ClearParameters;
    END_RESOURCE
END_CONFIGURATION