Supported platforms: CODESYS 2.3, CODESYS 3.5
This function calculates the resistance (Ohm) value with given ADC values of the sensor value and reference input value. The returned value (WORD) is presented with no decimals (1000 = 1kOhm).
The hardware specific library provides global (enumeration) G_AIType for value scaling.
This function will work only with:
The used input shall be configured as the selected type. |
Input variable name |
Data type |
Range |
Description |
i_ADCValue |
WORD |
0..65535 |
AD converter value to be scaled |
i_AIType |
BYTE |
0..G_ADScaleArrMax |
Index number that defines the AI input type and range |
i_ReferenceADCValue |
WORD |
0..65535 |
AD converter value of the reference voltage measurement (=supply of the sensor) |
i_ReferenceAIType |
BYTE |
0..G_ADScaleArrMax |
Index number that defines the reference input type and range |
Input variable name |
Data type |
Range |
Description |
i_ADCValue |
WORD |
0..65535 |
AD converter value to be scaled |
i_AIType |
ADData |
|
Structure that defines the AI input type and range |
i_ReferenceADCValue |
WORD |
0..65535 |
AD converter value of the reference voltage measurement (=supply of the sensor) |
i_ReferenceAIType |
ADData |
|
Structure that defines the reference input type and range |
Return value |
Data type |
Range |
Description |
|
WORD |
0..65535 |
Scaled sensor resistance value |
Source file Topic000246.htm
Last updated 24-Apr-2025