Author Topic: Ramps for analog out  (Read 6312 times)

William Steed

  • Guest
Ramps for analog out
« on: February 25, 2003, 04:19:36 PM »
Just wondering, on the M series is there any way you could ramp up/down the analog outputs over time.  I would like to ramp the signal full scale over say 1 second.  Could you please detail what would be required.

Thanks

Will S.
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

Ken

  • Newbie
  • Posts: 16
    • View Profile
Re: Ramps for analog out
« Reply #1 on: February 26, 2003, 08:41:00 AM »
Depending upon how many increments you want in your ramp over a one second period would be of importance.  Say you wanted to ramp from 0 to 100% of whatever the value you want is you would first scale your output by 100 or 1000 as to work around the floating point issue.  Then lets say you want to increment in tenths of a second, then all you would do is set a clock pulse of 0.1 s and add 10% of the desired value until you reach the high value.  In order to avoid a runaway situation use an if then statement to check if current value = high value and if so then dont run the ramp up sequence.  Hope this makes sense.  If you need some more clarification let me know.

« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »

support

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 3171
    • View Profile
    • Internet Programmable PLCs
Re: Ramps for analog out
« Reply #2 on: February 27, 2003, 01:48:47 PM »
Ken has given a very good explanation for performing linear ramp up. You can even do non linear ramp up/down by putting the values inside the data memory DM[n], E.g.

DM[1] = 0
DM[2] = 10
DM[3] = 20
DM[3] = 40
DM[4] = 80
DM[5] = 160

You can use a variable as index (e.g. I) and at every internal you do the following:

   IF I > 5  RETURN: ENDIF
   SETDAC 1,DM
   I = I + 1

Here you get an exponentially increasing DAC output!

« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »
Email: support@triplc.com
Tel: 1-877-TRI-PLCS

William Steed

  • Guest
Re: Ramps for analog out
« Reply #3 on: February 27, 2003, 07:27:02 PM »
Thanks, Ken and Support, I appreciate the help.  I will be trying this out soon.  

Will Steed
« Last Edit: December 31, 1969, 04:00:00 PM by 1076562000 »