Supported platforms: CODESYS 2.3, CODESYS 3.5

ADC_To_mAorV (FUN)

Description

This function scales the ADC value to voltage or current according to the selected input pin type. The ADC value is given to the function as an input and the function returns the calculated voltage or current value. The returned value (WORD) is presented with two decimals (675 = 6,75V or 6,75mA).

 

The hardware specific library provides global G_AIType for value scaling.

Inputs

CODESYS 2.3CODESYS 2.3

Input variable name

Data type

Range

Description

i_ADCValue

WORD

0..65535

AD converter value of AI input

i_AIType

BYTE

0..G_ADScaleArrMax

Selection of used voltage or current range in conversion

 

 

CODESYS 3.5CODESYS 3.5

Input variable name

Data type

Range

Description

i_ADCValue

WORD

0..65535

AD converter value of AI input

i_AIType

ADData

 

Selection of used voltage or current range in conversion

 

 

Return value

Return value

Data type

Range

Description

 

WORD

0..65535

Scaled voltage or current value

Example code

See also

 

Source file Topic000232.htm

Last updated 13-Jun-2024