RSLogix Maths Problem

jaichains

Member
Join Date
Jul 2005
Location
Rotherham
Posts
46
Hi

I am programming an Allen-Bradley SLC 5/04 through RSLogix 500. I have 8 user configurable integers (N7:10, N7:11, N7:12, N7:13, N7:14, N7:15, N7:16, N7:17). I want my ladder logic to calculate which is the biggest integer out of them.

One of the one way is where, i compare each integer with each other. But this will be really big and cumbersome. Can someone suggest another method to calculate this in RSLogix 500 using ladder instructions.. Thanks.
 
One thought would be to use something like a bubblesort or some other means of sorting your data into another data range set - that would be most useful if you needed the list in sorted order all the time.
 
Try:

BST CLR N7:0 NXB MOV 10 N7:1 BND

LBL 1 GEQ N7:[N7:1] N7:0 BST MOV N7:[N7:1] N7:0 NXB MOV N7:1 N7:2 NXB ADD N7:1 1 N7:1 BND

LEQ N7:1 17 JMP 1

This will end up with the largest value in N7:1, the index of the largest value in N7:2. It also uses N7:0 as an index holder. These can always be other locations.
 
Use a for/next loop and indirect addressing.

See the attached. This short routine will leave an indirect address pointer in N7:0 to the largest value and a copy of the largest value in N7:1.


edit: Bernie beat me to it. His solution is pretty much the same thing.
 
Last edited:
jaichains said:
Hi

I am programming an Allen-Bradley SLC 5/04 through RSLogix 500. I have 8 user configurable integers (N7:10, N7:11, N7:12, N7:13, N7:14, N7:15, N7:16, N7:17). I want my ladder logic to calculate which is the biggest integer out of them.

One of the one way is where, i compare each integer with each other. But this will be really big and cumbersome. Can someone suggest another method to calculate this in RSLogix 500 using ladder instructions.. Thanks.

Thats 8 rungs with a total of 15 instructions. Is that really big and cumbersome? :)
 
Mickey said:
I'm from Missouri, show me. Please.

I can only put the ascii code. Assume n7:0 is the final result:

1: MOV N7:10 N7:0
2: GRT N7:11 N7:0 MOV N7:11 N7:0
3: GRT N7:12 N7:0 MOV N7:12 N7:0
4: GRT N7:13 N7:0 MOV N7:13 N7:0
5: GRT N7:14 N7:0 MOV N7:14 N7:0
6: GRT N7:15 N7:0 MOV N7:15 N7:0
7: GRT N7:16 N7:0 MOV N7:16 N7:0
8: GRT N7:17 N7:0 MOV N7:17 N7:0

I like MO, especially around Linn Creek.
 
On a side note

I just had a situation where I needed to do the same thing, but instead of generating the code, Omron has an instruction called MAX, which you can define the length, starting register, and result register. There is also a MIN instruction.

This does not tell you what register it is in however, but that can easily be accomplished with a lookup table.

The Omron instruction set is huge, and I only use / know what a fraction of them do.
 

Similar Topics

Hi Everyone, I am not proficient in RSLogix 500 so I have a question regarding the evaluation of N7:0 data as an input. So as I understand in...
Replies
1
Views
84
Hi folks, in the alarm manager of Rslogix 5000, the tag-based alarm has been created. But when I tried to change the condition, it was found the...
Replies
2
Views
154
I have a little bit of experience with Allen-Bradley. I have a Micrologix 1500 (RSLogix 500) and a PanelView Plus 7 (FactoryTalk View Studio ME)...
Replies
3
Views
162
I am completely stuck on building a ladder program that requires a start button to be pressed 3 times to turn on motor 1. Then motor 2 starts...
Replies
20
Views
574
Back
Top Bottom