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
| Name | Type | Range / Units | Description |
|---|---|---|---|
| Module_ID | USINT | 1 - 15 | Unique identifier of the AI module. |
| Channel_Number | USINT | 0 - 3 | Specifies which AI channel to clear. |
| Channel_Mode | BOOL | 0 / 1 | Channel mode for which the clearing is done: 1 = 0-10 V, 0 = 4-20 mA. |
| CMD_Clear_Parameters | BOOL | TRUE / FALSE | Clears parameters on a rising edge (input goes from FALSE to TRUE). |
Outputs
| Name | Type | Description |
|---|---|---|
| STS_Done | BOOL | TRUE if the calibration parameters have been successfully cleared. |
| STS_Failed | BOOL | TRUE if the operation failed to clear the parameters. |
| STS_Fault_Code | USINT | Diagnostic code indicating the reason for failure. |
Fault Codes
| Code | Meaning | Description |
|---|---|---|
| 91 | Step1 Clear Failed | Clearing of calibration parameters failed. |
| 97 | Module Faulted | The AI module reported an internal fault. |
| 98 | Module Mismatch | The detected module type does not match the expected AI module. |
| 99 | Module Not Found | The 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