For instruction

igor_gouveia

Member
Join Date
Apr 2013
Location
Manaus
Posts
6
Hi guys,

I'm new in PLC world and I'd like to know how can I make a FOR instruction on RsLogix 500?
I'm using a Micrologix 1400.

thanks already
 
Use the forum search tool (not the google search bar) to search the forum for the key words FOR NEXT and you'll find lots of examples and also discussions about the disadvantages and where you should use loops and where you should not. On logix 500 you'll have to build your own loop with jmp and lbl instructions. Generally loops are used only with indirect addressing and only when you need to manipulate data in a single scan, for example, a sort or array math.

If you'll tell us what you are trying to do with the loop maybe we can help you with a better solution for your PLC.
 
Use the forum search tool (not the google search bar) to search the forum for the key words FOR NEXT and you'll find lots of examples and also discussions about the disadvantages and where you should use loops and where you should not. On logix 500 you'll have to build your own loop with jmp and lbl instructions. Generally loops are used only with indirect addressing and only when you need to manipulate data in a single scan, for example, a sort or array math.

If you'll tell us what you are trying to do with the loop maybe we can help you with a better solution for your PLC.

I couldn't find the examples that you said using the forum search, maybe I'm doing it wrong. Thanks for your help.
 
I don't wanna do anything with it by now, I just want to know how to use it in case I need later

well, in that case, here's a little DEMO exercise that might be useful ...

as TConnolly said, there is a lot of debate about where (and where NOT) these things should be used ...

in the meantime, working through the example I've shown should help you understand the mechanics ...

each time you manually toggle the "enable" bit (B3/0) on, the value stored at N7:1 should be increased by 10 ... this will demonstrate how the "looping" action works ...

TIP: put this into your processor, and get it working ... then use the RSLogix500 "Test – Single" feature to go rung-by-rung through the loop ... you can learn a lot that way ...

and welcome to the forum ...

.
 
Last edited:


well, in that case, here's a little DEMO exercise that might be useful ...

as TConnolly said, there is a lot of debate about where (and where NOT) these things should be used ...

in the meantime, working through the example I've shown should help you understand the mechanics ...

TIP: put this into your processor, and get it working ... then use the RSLogix500 "Test – Single" feature to go rung-by-rung through the loop ... you can learn a lot that way ...

and welcome to the forum ...

.

Thank you very much Ron. And another doubt how can I use this to fill an array?
 
Using "For/Next" as the search term pulled up a bunch of examples.
http://www.plctalk.net/qanda/search.php?searchid=3048849


To fill an array there is a much better and simpler way that a for/next loop: Use the FLL instruction.

However, for reference, if you wanted to fill an array using the example that Ron posted then you would replace the add instruction in rung 2 with a MOV instruction and use indirect addressing to index through the array.
 
Last edited:

Similar Topics

I'm trying to dig to the source of a minor "recoverable" system fault throwing a fault light on a machine that has been confusing my operator...
Replies
3
Views
74
I'm using a SLC typed write from the ControlLogix5572 to the MicroLogix 1400, with path: 2, (MicroLogix IP). The ControlLogix equipment has a...
Replies
0
Views
87
Does this instruction calculate values during a single scan, or does it require number of scans based on element count in the array? For Example...
Replies
3
Views
114
Hello All, Was hoping I could get a little help with Modicon ladder logic. This is the first time I have seen Modicon logic and currently trying...
Replies
6
Views
259
Hello all, I am currently trying to establish a message instruction to pass data from a 1756-L73 to a 1756-L71. My communication path from the...
Replies
8
Views
352
Back
Top Bottom