Get_FactoryCalibration
Overview
The Get_FactoryCalibration function block retrieves the factory calibration parameters (gain and offset) for a specific channel and mode on the Analog Input (AI) module.
💡 Factory settings
The AI module is factory calibrated during production, and the calibration parameters are stored in non-volatile FLASH memory. The module can be re-calibrated if needed, but factory calibration data cannot be overwritten.
Module_ID := (USINT)
Channel_Number := (USINT)
Channel_Mode := (BOOL)
CMD_Get_Factory_Calibration := (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 get factory calibration parameters for. |
| Channel_Mode | BOOL | 0 / 1 | Channel mode for which the factory calibration parameters are retrieved:1 = 0-10 V 0 = 4-20 mA. |
| CMD_Get_Factory_Calibration | BOOL | TRUE / FALSE | Get factory calibration parameters on a rising edge (input goes from FALSE to TRUE). |
Outputs
| Name | Type | Description |
|---|---|---|
| STS_Done | BOOL | TRUE when the factory calibration parameters are retrieved successfully. |
| STS_Failed | BOOL | TRUE if the get factory calibration process fails. |
| STS_Fault_Code | USINT | Diagnostic code indicating the reason for failure. |
Fault Codes
| Code | Meaning | Description |
|---|---|---|
| 94 | Get Factory Calibration Failed | The factory calibration get command 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_GetFactoryCalibration
VAR
AI_Get_FactoryCalibration : Get_FactoryCalibration;
Trigger_Tag : BOOL := FALSE; (* Internal toggling trigger *)
END_VAR
(* Trigger the factory calibration reset for channel 2 (4-20 mA mode) on module 5 *)
AI_Get_FactoryCalibration(
Module_ID := 5,
Channel_Number := 2,
Channel_Mode := 0, (* 4-20mA *)
CMD_Get_Factory_Calibration := Trigger_Tag
);
END_PROGRAM
CONFIGURATION Config0
RESOURCE Res0 ON PLC
TASK task1_20ms(INTERVAL := T#20ms, PRIORITY := 1);
PROGRAM Prog_Instance_AI_Get_FactoryCalibration WITH task1_20ms : PROG_AI_GetFactoryCalibration;
END_RESOURCE
END_CONFIGURATION