Supported platforms: CODESYS 2.3, CODESYS 3.5

 

PVC_To_PWMReq (FB)

Description

This function block scales the control signal value to the PWM percent with given parameters.

When i_Control is 0, o_PwmReq output value corresponds to i_CenterPositionPwmLevel value.

If i_Enable is false, o_ValveSupply output is false and o_PwmReq is 0, otherwise o_ValveSupply is true and o_PwmReq value calculated.

o_PwmReq output value is calculated based on scale factors read from Global G_AD_Scale array provided by the hardware specific library.

 

Limitations

This function block is primarily intended for ProportionalValveControl library's internal use.

Inputs

CODESYS 2.3CODESYS 2.3

Input variable name

Data type

Range

Description

i_Enable

BOOL

FALSE/TRUE

Enables the outputs

i_Control

INT

-32768..32767

Control signal to be scaled

i_PosDirMaxPwmLevel

UINT

0..1000 (0,1%)

Maximum PWM percent for positive direction,1000 = 100,0%

i_PosDirMinPwmLevel

UINT

0..1000 (0,1%)

Minimum PWM percent for positive direction,1000 = 100,0%

i_CenterPositionPwmLevel

UINT

0..1000 (0,1%)

PWM percent for center position (i.e. zero position),1000 = 100,0%

i_NegDirMinPwmLevel

UINT

0..1000 (0,1%)

Minimum PWM percent for negative direction,1000 = 100,0%

i_NegDirMaxPwmLevel

UINT

0..1000 (0,1%)

Maximum PWM percent for negative direction,1000 = 100,0%

 

 

CODESYS 3.5CODESYS 3.5

Input variable name

Data type

Range

Description

i_Enable

BOOL

FALSE/TRUE

Enables the outputs

i_Control

INT

-32768..32767

Control signal to be scaled

i_PosDirMaxPwmLevel

UINT

0..1000 (0,1%)

Maximum PWM percent for positive direction,1000 = 100,0%

i_PosDirMinPwmLevel

UINT

0..1000 (0,1%)

Minimum PWM percent for positive direction,1000 = 100,0%

i_CenterPositionPwmLevel

UINT

0..1000 (0,1%)

PWM percent for center position (i.e. zero position),1000 = 100,0%

i_NegDirMinPwmLevel

UINT

0..1000 (0,1%)

Minimum PWM percent for negative direction,1000 = 100,0%

i_NegDirMaxPwmLevel

UINT

0..1000 (0,1%)

Maximum PWM percent for negative direction,1000 = 100,0%

i_PWM_Maximum

UINT

 

PWM maximum value for scaling.

 

 

Outputs

Output variable name

Data type

Range

Description

o_ValveSupply

BOOL

FALSE/TRUE

Control condition for valve supply volt output

o_PwmReq

UINT

Hardware specific

PWM request for voltage valve, range/scale is hardware specific.

Example code

See also

-

 

Source file Topic000335.htm

Last updated 24-Apr-2025