Maximum value

Ricdel

Member
Join Date
Aug 2004
Posts
2
I'm using RSLogix 500 Rev 4.50.00

Does anyone know how to capture a maximum value from an analog input over a specified time frame?

Thanks.
 
From the Silver Platter Department

Sounds like you will need a timer, a Compare, and two move instructions. Throw in a couble of timer bits and a bool and your done.
Here is the code....

XIO B3:0/0 TON T4:0 1.0 10 0
XIC T4:0/TT GRT I:1.0 N7:0 MOV I:1.0 N7:0
XIC T4:0/DN OTE B3:0/0
XIC B3:0/0 MOV N7:0 N7:1

This will work, you'll have to change the addressing to your real world but there you go. Of course you may need to add another timer if you want a delay between measurements.

:oops:
 
Last edited:
Quick answer off the top of my head is:

Have a timer for the period of time desired, or depending on which PLC your using, trigger the start/stop with the real time clock.

Lets say N17:0 will hold the max value and I:3.1 is the input.
Then while the timer is timing, or event triggered:
Compare I:3.1 to N17:0,
if I:3.1 is greater than N17:0,
move I:3.1 to N17:0.


When the timer times out you will have the max input value, over the time period stored in N17:0.


Ken


Bitmore beat me to it, but we both have the same basic solution. If your PLC has a real time clock, you could also capture the time at the highest value.
 
Last edited:
OK, so you've had 2 great examples. An added thought is, are you going to do more testing in another time period? If so and if you want a new maximum just for this next time period then you must set the target (N7:0 in the first example, N7:17 in the second) to zero (CLR N7:XX).
 

Similar Topics

Hi all, I'm not too familiar with SCL programming and I need some guidance on writing a simple code in SCL that scans through a given number...
Replies
9
Views
4,714
hi guys, is there any formula to calculate input maximum value in SCP block where input minmum value is -25383 on 0Kg what will the maximum...
Replies
1
Views
1,629
My question is, when there is 10V on the first channel of an 1771-IFE card, what decimal value will show up in the data file word (happens to be...
Replies
15
Views
6,077
I'm working on a small program using the Automation Direct DL05 PLC. For the timer that I am using (TMRA) I have a preset value (K) of 324000. I...
Replies
4
Views
2,471
hi there, I have a tag in which is stored realtime value of voltage. I'm need a way to record a maximuum value of this voltage and dispay it on...
Replies
3
Views
3,996
Back
Top Bottom