oscat.lib > oscat.lib fuer Step 7

STIME - isn't there a more simple way

(1/1)

AkosMurin:
Hi,

I'm new to OSCAT and have seen the porting to Step7.
The STIME function seems to be too complicated to me.
Don't You think that following would be more simple?

Important: I write my personal opinion here, please correct me if I'm worng.

1) At warm or cold start the tx:=0 -> this is possible from OB100 directly.
2) In OB1 read the OB1_PREV_CYCLE and add it to tx
3) If tx (as DWORD) is bigger than (2^^32-1) then substract that from tx.

Add 1) I think that within a single PLC cycle time is frozen, therefore there is no reason to read system time more than once.
         Therefore tx shoul be stored at a central location (DB or M) and normal functions should only read this.
         Cyclic initialization of tx should occur at the beginning of each cycle only once.
         This is especially stands for STIME, since in a normal control program it might be called many many times.

Add 2) Add 1) Stands for other PLC-s also.

Add 3) It might be necessary to update tx within a PLC cycle in some cases - although I do not see a reason now.


Skotti:

--- Zitat von: AkosMurin am 27. März 2009, 07:58:04 ---Add 1) I think that within a single PLC cycle time is frozen, therefore there is no reason to read system time more than once.
         Therefore tx shoul be stored at a central location (DB or M) and normal functions should only read this.
         Cyclic initialization of tx should occur at the beginning of each cycle only once.
         This is especially stands for STIME, since in a normal control program it might be called many many times.
Add 3) It might be necessary to update tx within a PLC cycle in some cases - although I do not see a reason now.

--- Ende Zitat ---

It is necessary, because some functions could be started in different OBs (for example OB35 etc.). Or the OB1 cycle is interrupted by another OB and therefore the OB1 cycle time is increased.

Skotti

dalbi:
100% ACK

Gruss Daniel

Navigation

[0] Themen-Index

Zur normalen Ansicht wechseln