It seems something went wrong, because I was interrupted by a colleague and in this way it took me too long to respond, so I became a guest with an incomplete post. I'm retaking it from the top:
OK, I'm back in the office, the necessary paperwork has been done and I'm free again to tackle the everyday technical stuff, which I like much better than paperwork
.
The problem with OB152 exists only because Siemens wants to do all cycletime statistics with only one function. The first thing to do is tell OB152 which function you want to perform. To do this, just load the function number in accumulator 1 prior to calling OB152. The functions available are:
- Function 0: switch off statistics
- Function 1: read actual and last cycletime (actual cycletime gives an incorrect reading)
- Function 2: reads minimum and maximum cycletime
- Function 3: read average cycletime and cyclecounter
- Function 8: initialise the cycletime statistics
- Function 15: switch on statistics
You can start the statistics for instance in the initialisation OB's like this:
L KF +15 Start statistics
JU OB 152
Reading the statistical information has to be performed from an FB, because the instruction to exchange accumulators 1 and 2 (TAK) can only be performed in an FB. To extract the actual cycle time (from accu 1) and the last cycle time (from accu 2) use the next sequence:
L KF +1 Read actual + last cycle time
JU OB 152
T FW 100 Save actual cycletime in FW 100
TAK Exchange accu's 1 and 2
T FW 102 Save last cycletime in FW 102
I hope this info helps.
Kind regards,