Jump to content

Recommended Posts

Posted

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

  • MVP 2023
Posted

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.

Posted

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.

  • MVP 2023
Posted

Pretty clever, Kikis. An excellent way to "cheat" the system. What frequency did you choose for your PWM? You'll only be able to increment the MI once per scan, unless you use an interrupt routine.

Joe T.

  • External Moderators
Posted

A smart solution. I usually have an self-resetting timer and load the timer value to MI in a linear FB.

Posted

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.

Posted

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...........

  • External Moderators
Posted

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.

  • 4 weeks later...
Posted

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.

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
×
×
  • Create New...

Important Information

This site uses cookies. By clicking I accept, you agree to their use.