Compare values and sample only the largest value

arefor32

Member
Join Date
May 2005
Location
Pembroke, MA
Posts
8
Hello All,



My customer has 4 sensors which I am reading via a SCL500 1746-NI4. Each sensor outputs 4-20mA. I scale each value to 0-100 and move them to N7:1 thru N7:4.

I would like to compare the values and move the largest value to another integer file N7:10. Can someone tell me the best way to attack the problem? Typically I like to scratch out my logic on paper first but I can not seem to get it right.


For example, if I had only 2 sensors…



Sensors A & B



----A>=B-------- MOV A-----

----B > A-------- MOV B-----



Thanks is advance for your help!
 
Searching for the largest:

MOV N7:1, N7:10
GRT N7:2, N7:10 then MOV N7:2, N7:10
GRT N7:3, N7:10 then MOV N7:3, N7:10
GRT N7:4, N7:10 then MOV N7:4, N7:10
 
Greetings arefor32,

First, Always move any one of the 4 sensors to N7:10, then check the others:

Here, On each scan sycle, A is moved to N7:10 then if B > A, then N7:10 is updated with B and so on.

------------------ MOV A-----

----B > A-------- MOV B-----

----C > B-------- MOV C-----

----D > C-------- MOV D-----
 
Thanks for the quick response...

My first attemp was simular to what you suggested. I found my error...I was clearing N7:10 first by moving a zero which was not only unnecessary but over writing the other statements.

Then I started going down the comparison path which again was not needed. Thanks again.
 

Similar Topics

I'm working on an array that contains a UDT of 5 Items Array[4] DataType[0] - Part 1 - Part 2 - Part 3 - Part 4...
Replies
1
Views
839
Looking at the compare values instruction, it seems as though you have to use 2 separate boolean tags to perform a greater than or equal to...
Replies
3
Views
1,158
hello. i am trying to store the values of a sensor every 1 minute to an array of 3. and compare the 3 values to see of the values is increasing or...
Replies
12
Views
3,522
Hi Guys, Im back again after 1&1/2 year. But my question is... How can I read values in excel file especially from one column then compare it with...
Replies
4
Views
1,936
I am using rslogix5000 and a controllogix L73 Processor. I need to compare 4 analog position inputs and use the highest or lowest input value to...
Replies
5
Views
4,004
Back
Top Bottom