Programming with high-level language elements
Structure program counter
The programming example shows a possible structure for a program counter used, for example, in a machine with a bar loader.
The R parameters can also be replaced by user-defined variables. The desired number of pieces can be specified with R0 (in the example: R0=100). The actual number of pieces is updated with R1 at the end of the program (in the example: R1=R1+1). On reaching the desired number of pieces, the program jumps to the END: instruction and the program runs on M30.
As long as the desired number of pieces has not yet been reached, the program jumps back to the beginning and remains in continuous mode.
It is assumed in the program structure illustrated that the actual number of pieces recorded with R1 will be reset to zero manually as required. This is the case prior to the first start and each time the desired number of pieces is reached.
Resetting to zero
Resetting to zero from within the program looks like this.
Siemens accepts no liability for the general validity or functional safety of the program example shown.