Absolutely, STAGE helps segment to code, I like it. Got questions on when an instruction executes and how to return to $Main.
'Return' implies a call. Blocks are not called they are enabled. Logically speaking, the entire program is evaluated every scan. We start at the top, and as we come to a program or task block, we check to see if it is scheduled to run this scan. If so, we then check to see if it was suspended from a previous execution (like might happen with a loop) and we resume at the yielded instruction or start at the top as appropriate. We then execute that block to the end, or if looping, until the time slice is expired. If a task or program block is not scheduled, we skip over its code.
Within program blocks, you can have stages. Stages are like mini-tasks, such that when we come to a stage, we determine whether it is enabled, and execute it or skip over it. When you jump from a stage to another stage, that isn't a call, it just disables the stage you are on, and enables the stage you are jumping to.
In an active stage a CTREGRD instruction which is edge triggered needs what in the power rail to execute once?
Just connect it to the power rail. When the stage is energized, the edge instruction will run one time. It is not necessary to put any additional logic.
I assume you are using CTREGRD as an example only. As I mentioned, I seriously doubt that you should be using it.
I don't see how to create only one low to high edge. I know the answer is simple, just don't know what it is!
For any instruction that shows the clock edge, it is already internally edge triggered, so you don't need to do anything. Clocked edges are indicated with the triangle on the input.
Where you need to create an edge, you can use a rising or falling edge contact...try pressing Shift+F2 or Shift+F3, or you can insert an edge conversion into the result of a non-edge rung...from the instruction pallet they are at the top under 'Contact Power Flow' and are ovals with rising and falling clocks, or you can use PD or ND boxes.
How about MOVE which is not edge triggered, how to do one move only? Or should I have those in their own stages and no pending condition that would create a loop?
It will perform the move every scan it is run and enabled. If you want to do it just one time, either one-shot the input, or put it in some code element that is run and then disabled.
The examples for stage programming are simple and don't address anything but OUT & SET type instructions.
Stage is all about sequencing. It doesn't take complicated instructions to understand how it works.
Examples don't return to the calling program either. Do you EXIT when the last stage is done to turn off the stage and return to the calling program?
Nothing is ever called, hence never needs to return. It is enabled or disabled to run. When you run a Program block, it continues to run every scan until EXIT is called. If you want to stop it, just call EXIT.