Jump to content

Analog out with up-down ramp


Recommended Posts

Hi guys,

What's the best way to have an analog 0-10V output with up and down ramp time?
I want to have a ramp time of 0.3 sec for my signal.

For example when i want to have 5V, instead of storing 511 (For 10-bit analog) immediately to the linked MI, i want the integer to be increasing gradually for 0.3 seconds and then to take it's final value. The same must happen when the MI is reset (From 5V to 0V).

Thanks in advance,
Kikis

Link to comment
Share on other sites

  • MVP 2021

The best resolution you're going to get with your ramp is 0.01 sec, or 30 segments. If you use a 0.01 self-resetting timer to increment an MI from 0 to 30, you can feed the MI into a Linear block as the X value. Set the Y value to the raw limits of the analog output (0-1024) and map the Y value to the analog output.

Instant ramp.

Joe T.

Link to comment
Share on other sites

Hi Nacho,

I start a timer of 0.3 sec.

I use the inverted contact of this timer as a condition to run PWM with 50% duty cycle.

Then i use the Positive transition contact of PWM result MB in order to increment an MI and use it as the X value in a linear block.

Link to comment
Share on other sites

I think that it would be great if Visilogic offered a ramp function for analog output.

Just like the way we configure a filter for analog inputs.

The user to enable/disable the ramp and link an MI for the ramp time from the hardware confuguration menu.

Link to comment
Share on other sites

how about using an addition function to add some amount to itself every scan and then use the result as the input to a scaled block?

change the amount added to change the speed of the ramp.

If Y is less than Setpoint,

Then add X to Y

Can also decel with subtract.

Could also control around a setpoint...........

Link to comment
Share on other sites

  • External Moderators

how about using an addition function to add some amount to itself every scan and then use the result as the input to a scaled block?

change the amount added to change the speed of the ramp.

Because the Scan time is not a fixed time the ramp will not be accurate.

Link to comment
Share on other sites

  • 4 weeks later...

Because the Scan time is not a fixed time the ramp will not be accurate.

It will if this is done in a interrupt routine

orrrrrrrr you can use the scan time as the base for a "timer"

every scan, take the scan time from the system register and add it to a total time.

When the total time exceeds the desired time, trigger some event and reset the total.

Simple easy scan independent timer.

Doesn't matter what your resolution is, unless you use an interrupt, nothing will happen until the ladder scan gets to that point in the logic anyway.

INCrement makes a quick and easy ramp too.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...