Retained vs Cleared: VC and VS
Know which common variables survive program end and which are wiped.
The OSP has two families of numbered variables. VC1–VC200 are retained — they keep their value across program end and even a power-off, which is what makes them right for a running part count. VS1–VS100 are reset to null the moment the program ends, so they're scratch space for one run only. Use a VC for anything the next program needs to see.
Your turn
VC50 is a retained common holding the good-part count that survived from the last run. Add one for the part just finished, then set VC51 to twice the new count so the pallet total is ready for the next program.
The machine gives you
VC50 = 7VC50 = 12Your program is run once for each set of conditions. It has to work for all of them.
This is a learning simulation — always prove out a program on the actual control before you cut metal.