RSLogix 5000 Creating a Triangle pulse Ladder Logic

It could be as simple as adding a small value to a register on each sweep, and then subtracting that same value from the register once you have reached a preset maximum value.

I found this searching the forum.
attachment.php


I am going to try and implement this on my flasher program since I already have a running timer. I believe I just need to add the SCP block after the timer. Is this a reasonable idea?
 
I found this searching the forum.
attachment.php


I am going to try and implement this on my flasher program since I already have a running timer. I believe I just need to add the SCP block after the timer. Is this a reasonable idea?

If you want to minimize steps in your output curve, then you'll be better off with real numbers, rather than integers.
 
If you want to minimize steps in your output curve, then you'll be better off with real numbers, rather than integers.

The effects of real numbers vs integers on the plot is beyond my scope of knowledge right now. This is our second lab and the first one (flasher) we were walked through. I'm searching the forums looking for a basic ramp program. It does not have to be the most efficient method. I'm sure this lab will be used as part of future labs so I definitely want to understand whats going on. Also thanks to everyone for the help thus far
 
I've been thinking about this for a bit.

If I create a timer, then divide the timer preset by 2, and then subtract 1/2 the timer preset from the timer .ACC, then take the absolute value, I get a number that counts from 1/2 the preset down to 0 and then back up to the preset. ABS(Timer.ACC-(Timer.PRE/2))

For example, if I have a 2000 millisecond timer, the number I get goes from 1000 down to 0 and then back up to 1000.

I can plug that into an SCP block with my scaled min and scaled max inverted, or I can use a line function in a CPT (compute) statement.

Using the line function y=mx+b:

  • x = 1000 when timer.acc is 0.
  • x = 0 when timer.acc is 1000
  • x = 1000 when timer.acc is 2000 (timer.acc = timer.pre)
  • I want to ramp from 0 to 100% and back down, so...
  • my m term will be (-100/1000) and my b will be 100.


Reset the timer when it times out and you'll have a continuous triangle wave generator that ramps 0 to 100% in one second, then back down in one second, lather, rinse, repeat.

Since this uses floats it might be beyond what your instructor is looking for, you may want to just use two timers, one to ramp up and one to ramp down. The ramp down timer is started by the end of the ramp up timer. When the ramp down timer completes it resets the ramp up timer. Then use the .acc of whichever timer applies in a line equation or an SCP block.
 
Last edited:
Hi guys,

About using the SCP block.
attachment.php


This is my Flasher main routine
EgnyyYy.png

This is the Counter routine
js9buvd.png

This is the Flasher Routine
hTGN7k5.png

Tags
xxA6hHL.png



Should I delete the "Flasher Routine" and create one called "Ramp" then use the TIMER and SCP block the way TConnolly said? I am looking up RSLogix5000 tutorials since I am not really familiar with the program other then from this Class.
 
Last edited:
I can see from your screenshots that your Logix5K project does not have the SCP add on instruction imported. If you want to use it you'll need to download and import the AOI. AOIs are advanced programming. Since you are a beginner it may be easier for you to use a line equation and a compute statement, or a periodic task and just add and subtract.

I'm not sure if you haven't noticed or not, but so far we haven't actually done you homework assignment for you, we've just discussed techniques and ways you could do it. We are happy to tutor be we usually don't do homework because someday you will be our coworker and we are looking forward to it while hoping you will be competent. I commend you for not automatically expecting us to drop an answer in your lap, a lot of students come here expecting exactly that.

What we don't know is what your instructor has taught you and so we have to be careful we aren't going to far off track. So think about what instructions he has covered so far and what we have said and put the two together.

You can leave those other subroutines there and just add another. Make sure you call the new subroutine with a JSR in the main routine.
 
I can see from your screenshots that your Logix5K project does not have the SCP add on instruction imported. If you want to use it you'll need to download and import the AOI. AOIs are advanced programming. Since you are a beginner it may be easier for you to use a line equation and a compute statement, or a periodic task and just add and subtract.

I'm not sure if you haven't noticed or not, but so far we haven't actually done you homework assignment for you, we've just discussed techniques and ways you could do it. We are happy to tutor be we usually don't do homework because someday you will be our coworker and we are looking forward to it while hoping you will be competent. I commend you for not automatically expecting us to drop an answer in your lap, a lot of students come here expecting exactly that.

What we don't know is what your instructor has taught you and so we have to be careful we aren't going to far off track. So think about what instructions he has covered so far and what we have said and put the two together.

You can leave those other subroutines there and just add another. Make sure you call the new subroutine with a JSR in the main routine.

Yeah, plus I can actually feel myself learning so I am enjoying working through this lab. I want to be able to do this so I will have an easy time on the test.
The SCP AOI is definitely a above what we have learned so far. Our professors only requirement was that it had to be done with ladder logic. He mentioned since we already have a running timer on our flasher lab we could modify that. He went over a few blocks that we should use counter,timer,move the different comparing blocks GRT, LEQ. He also mentioned y=mx+b so I think you are right about sticking to the compute statement.

Its difficult not having the Rslogix5000 program at home so I can practice anytime like I do with Matlab and other programming software.
 
Its difficult not having the Rslogix5000 program at home so I can practice anytime. . .
That is the disadvantage with learning on an expensive software package. There used to be a 7-day Grace period (Version 17), in which you could run RSLogix5000 without an authorization. I don't know if that still applies.
 
If you'll look at that spreadsheet I posted earlier you can see how to construct some logic using y=mx+b with a timer providing the x term. See if you can convert that to ladder logic and post back here with it and we'll help you refine it.
 
That is the disadvantage with learning on an expensive software package. There used to be a 7-day Grace period (Version 17), in which you could run RSLogix5000 without an authorization. I don't know if that still applies.

Yeah I looked into this but it seems they took down every link to the v17 trial version. Even the v15 trial was taken off.

If you'll look at that spreadsheet I posted earlier you can see how to construct some logic using y=mx+b with a timer providing the x term. See if you can convert that to ladder logic and post back here with it and we'll help you refine it.

Will do.I have class tonight so I am going to try a couple things and I will post my results.
 
If you'll look at that spreadsheet I posted earlier you can see how to construct some logic using y=mx+b with a timer providing the x term. See if you can convert that to ladder logic and post back here with it and we'll help you refine it.


I found a ramp program from searching the forums. I think you posted it
attachment.php


I set it up today before class. I had a question the Tag to use for the RampingOn XIO, The tag for the CPT block...I was using double integer and where I should plot the trend?

I created another routine called "Ramp" and made sure to JSR to Ramp in my main routine.
 
Possibly out of the scope of this discussion, but on a processor that supports periodic tasks, like a Logix processor, I generally just create a periodic task, say with a 10ms time base, and use that with simple ADD/SUB and some limiting instructions to generate ramps.

Using something like that, you can use external logic to just trigger flag bits for RAMP_UP, RAMP_DOWN, RAMP_HOLD, RAMP_RESET and such.

Doing it this way, you can easily generate a triangle waveform of just about any amplitude by toggling between the RAMP_UP and RAMP_DOWN commands when you hit your amplitude limits.

Also, you can much more easily use real numbers for the ramps, rather then scaling an integer.
 
I found a ramp program from searching the forums. I think you posted it
attachment.php

Hey guys I got this program running. i am taking the trend at RampTimer.acc, it is a ramp, but a saw tooth not triangle. is there anyway to modidy this into an actual triangle? Can I take the second rung and invert it to make the ramp down?

Edit:I think I am creating the trend with the wrong tag?
 
Last edited:
When I run the program my RampTimer.Acc goes up to 10k then stops.

I made the tag for the "RampingOn" normally open input a bool tag is that correct?
 
Take that program and change the equation in the CPT instruction so that it uses a line equation similar to the one in the spreadsheet above. You'll need to add a tag and a DIV instruction where you calculate 1/2 the timer preset. The absolute value instruction is ABS and you can use it as a stand alone instruction or you can use it in the compute statement, as in ABS((m*x)+b).

What you want to do is generate this line function
where slope is negative
\ |
\ |
\|
-------+--------
|\
| \
| \

and turn it into this line function with the ABS instruction and
use the b term to set it up so it starts at y=0
\ | /
\ | /
\|/
-------+--------
|
|
|


 

Similar Topics

I only have one machine here with a ControlLogix PLC. It uses firmware 20.04 and I have RSLogix 5000 Full Edition. I am experienced with RSLogix...
Replies
13
Views
10,289
Hi guys I have been working at the same company for 10years , and I would like to try and make the engineers job easier in the fault finding plc...
Replies
1
Views
1,469
In function block programming I am wanting to be able to select from 4 different flow meter tags to point to an equation depending on the mix tank...
Replies
1
Views
2,835
I was just wondering if someone might be able to help. I am trying to create a new Structured Text routine in RSLogix 5000. However when I go to...
Replies
3
Views
4,015
Hello, I am trying to read a barcode scanner input using a cognex dataman 280 barcode reader, store it another string, the compare with another...
Replies
1
Views
62
Back
Top Bottom