Host Engineering Forum
General Category => Do-more CPUs and Do-more Designer Software => Topic started by: Dean on January 10, 2017, 02:37:09 PM
-
So I have several programs called from Main. Each Run instruction in Main requires two inputs in series to start the Program. One of the inputs is used as a falling edge within the program to HALT. As long as the PLC is in RUN, everything works as intended. I would like to HALT all the programs on a power cycle as well, and turn off all outputs within the programs. I have HALT instructions for each program tied to the first rung in Main with ST0 as the input, but this doesn't have the desired result. The programs have C-bits (C1-C5), that are tied to outputs in main. (Full disclosure, I've reused the C-bits in all of the programs, but only 1 program runs at a time, so I figured this was OK.) When I transition from RUN to STOP with the inputs on, then turn the inputs off and transition from Stop-to Run the C-bits go true as though the program is still running, and the RUN requirements are still met. What am I not understanding/doing wrong? This is all taking place in the Simulator if that makes any difference.
-
Sounds like you want to make all your user code block heap-items NON-retentive, i.e. after power cycle NONE of them will be "running" after a power cycle (except $Main, which is ALWAYS retentive).
Any C-bits from Main which want to cause a program code-block run should also be NON-retentive.
Look at your Memory Configuration in the System Configuration dialog to set the "retentive" range for C-bits and heap-items.
An alternative to using HALT from $Main, is to use the EXIT instruction INSIDE each Program code-block. This provides better "shut down" behavior as compared to HALTing from $Main. If you are using Stage inside your programs, you want this special EXIT rung to be BEFORE your first SG (i.e. before the "initial stage"), so that it runs on EVERY scan regardless of which stage is currently active. Note that EXIT causes the current code-block to jump to the end of the code-block IMMEDIATELY, so no other logic in that code-block is ran THAT scan.
-
Thank you for replying.
1. I double checked to be sure, but none of the Program Code Blocks are configured to be retentive.
2. I figured that setting bit to be non retentive was the answer, and I'm really struggling to understand how to set that up. I see how to set all C bits to non retentive, but cant seem to figure out how to set a range of them one way or the other.
-
2. I figured that setting bit to be non retentive was the answer, and I'm really struggling to understand how to set that up. I see how to set all C bits to non retentive, but cant seem to figure out how to set a range of them one way or the other.
See the attached picture (EDIT: see other post for picture) of the Memory Configuration dialog and Edit Block dialog. First, select the C bit block in the Memory Blocks list. Second, hit the Edit Memory Block button. Third, change the Retentive Range from the Entire Block to This Range Retentive and tweak the From block ID to 1024 (so the first half is non-retentive). You can make any range be retentive (it must be on DWORD boundaries, multiples of 32, e.g. C0, C32, C64, ... C1024, C1056, etc.), so you don't have to do what I did.
-
See the attached picture
Take 2.
-
I get it now. Thanks for taking the time to explain this.