Jump to content
Sign in to follow this  

Linear ramp output

Recommended Posts

This is a UDFB for linear ramp output with rise and fall time.


The program detects change in the target value and ramps the output until it reaches the set point.

If the new target value is greater than the current value, it makes a rising ramp.

If the new target value is less than the current value, it makes a falling ramp.

Calculates the relative ramp time according to maximum ramp and fall time given by the user.


Function Inputs:

Target value

Rise time (This is the maximum rise time from the minimum output value to the maximum in msec)

Fall time  (This is the maximum fall time from the Maximum output value to the Minimum in msec)

Maximum value of output

Minimum value of output


Function Output:

Ramped output register



I wrote this UDFB to control hydraulic pressure using proportional valve via analog output. It could also be used to drive a stepper motor with acc/dec using pulse width modulation.

  • Like 1
  • Upvote 3

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this