Exactly as you've described it. In general (there are always exceptions), your ladder will be scanned sequentially, from left to right, and top to bottom. Your PLC never "looks back". So, if you had a a rung like this, and when the rung started executing, M1 was true:
Code:
| M1 M1
|----| |----------------+-----( R )-|
|
| M2
+-----( )-|
...then the PLC will execute as follows.
- M1 is true, therefore, execute the instructions at the end of the rung
- First instruction to execute: turn off M1
- Second instruction to execute: turn on M2
M2 now remains on for the rest of the scan - even though you would look at that rung, and see that M1 is off and you might not think it would execute the coil for M2. But by the time it gets to that point, the PLC has already proceeded past that ---| |--- of M1, and decided it was true. It won't look back at it.
So, as your memory bits are set/reset in the code, they are on/off from that point onward. That also applies to I/O, for that matter. e.g.:
Code:
| M1 Q1
|---| |---------------------( )-|
|
| Q1 Q2
|---| |---------------------( )-|
In this instance, the PLC will turn on both Q1 and Q2
in the same scan (or rather,
after the same scan). It does NOT activate Q1, wait for the rest of the scan to continue, turn on the output, and then come back through and say "OK,
now Q1 is on, so I'll turn on Q2. As far as the logic is concerned, as soon as you set a bit, it's set. It's purely the
hardware that's not updated until the end of the scan.
One final tip: not all PLC's do the "read inputs....execute code....write outputs" any more. Compact Logix and Control Logix PLC's, for example, update the I/O asynchronously, which means the status of an input could be updated halfway through a rung. Search the forum for threads on this topic and you'll find a ton of information on this, including things to be aware of and ways to overcome it.
Hope that sheds some light on things for you!