Thanks for drawing this.Here is a basic flow chart that takes into account direction polarity if the Start position is less than or greater than then End position.
The code is blocking, which is how the original code was written, but this can evolve to non-blocking with a more advanced next level "dispatching mode" flowchart implementation.
As is, for "blocking":
- Node 02 would have a Delay(15) or (20) and you would remove "Start Period Timer (20ms)" from Node 07.
For a "dispatch mode" flowchart conducive to "non-blocking":
- The Node reference is a variable Index pointer.
- Each Node does NOT call the next node in the flow but can change the Index pointer.
- Each Node returns to the main program where a dispatcher (If Index pointer is this then go to a corresponding Node).
This can be greatly simplified with the use of "switch case" and "goto" statements. Even though the goto statement is frowned upon, the use of it in this circumstance is an exception.
- This way with more complex designs you can have multiple flowcharts, each with their own Index Pointer, that interdigitate
their Node States.
- Node 02 simply looks for elapsed time to either count down or count up depending on how you write the code.
- Node 07 grabs a new starting point for the Period Counter with "Start Period Timer (20ms)" that Node 02 can reference.
View attachment 295927