My biggest stumble seems to be visualising how the system is sequenced or controlled and then getting that down on paper.
It also needs to have the ability to make a single manually triggered stamp and likewise a manually triggered feed/cut, these are used when setting up.
Your state 1 and 3, would they completely separate sections of code or the same section multi tasked? If it's separate sections that are tailored to one job ie stamp or stamp/cut, what's the best way of controlling the single output function with the multiple source codes?
I think I need some more reading, it's this first step that I find the hardest - visualising the code and how it interacts, I also need to improve my state control method.
Maybe my idea of a state is too broad? In this instance would each state here...
State 0 - Off
State 1 - Stamp
State 2 - Feed
State 3 - Stamp+cut
State 4 - Feed + cut
be an isolated part of code? If not then transitioning would be difficult?
I am slowly (very) seeing how the transition logic decides which state comes next, based upon the machine being in auto run or manual set up etc.
Settling on a state control needs to be done, my current method has pitfalls that will stop it working properly unless each state is isolated because I use EQU and NEQ in some parts to make decisions, clearly if I'm using the same code for two different states, this will fail badly. That points to me that each state needs an individual block of code, all of which are tied to the same outputs at the output section - parallel bits seem the way there?
This simple little machine is proving most fascinating when pulled apart