News:

  • April 19, 2024, 03:37:26 PM

Login with username, password and session length

Author Topic: Stage: Storing memory after JMP  (Read 3271 times)

gened9

  • Newbie
  • *
  • Posts: 3
Stage: Storing memory after JMP
« on: April 14, 2015, 08:00:24 AM »
If I assign a value (K101) to memory (V2050) within a stage, and I want that value to stay in memory after I jump out of the stage, do I put the LD K101, OUT V2050 instruction line after the jump instruction line? If I understand right, a JMP instruction will turn off all OUT instructions and reset all memory locations to 0. Right?
Thanks


plcnut

  • Hero Member
  • *****
  • Posts: 803
    • premiersi.com
Re: Stage: Storing memory after JMP
« Reply #1 on: April 14, 2015, 08:46:42 AM »
Your OUT *coils* will be reset when you JMP, but when you place a number/data into a memory location, it will stay there until something else writes to the same memory location. (This can happen when the PLC is re-started.)
Circumstances don't determine who we are, they only reveal it.

~Jason Wolthuis
Premier Systems Integration, LLC
http://premiersi.com

gened9

  • Newbie
  • *
  • Posts: 3
Re: Stage: Storing memory after JMP
« Reply #2 on: April 14, 2015, 08:48:24 AM »
Thanks.

franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3658
    • Host Engineering
Re: Stage: Storing memory after JMP
« Reply #3 on: April 14, 2015, 08:56:01 AM »
If I assign a value (K101) to memory (V2050) within a stage, and I want that value to stay in memory after I jump out of the stage, do I put the LD K101, OUT V2050 instruction line after the jump instruction line? If I understand right, a JMP instruction will turn off all OUT instructions and reset all memory locations to 0. Right?
All instructions within an enabled stage will execute until you disable the stage.  JMP is one way to disable a stage, but the remaining instructions following the JMP will still execute on that one last scan.  Technically, JMP will enable (SET) the designated stage bit and then disable (RST) the stage containing the JMP.  It does not physically Jump to that stage.  This is a "higher level" logical jump in a Stage Diagram sense (transition/jump from S1 to S2), not an assembly language sense.

All OUT COILs within a stage will be RESET automagically when you disable the enabled stage.

However, user V memory locations are NOT affected by this.  TMRs and CNTs may reset, but not any referenced memory in boxes like LD and OUT numeric boxes.

So, when you do LD/OUT on the same rung that has the JMP, those output boxes could be BEFORE the JMP, or AFTER the JMP in that same rung, but it will basically have the same behavior.