Autor Thema: STIME overrun?  (Gelesen 9560 mal)

0 Mitglieder und 1 Gast betrachten dieses Thema.

c3p0

  • Gast
STIME overrun?
« am: 12. März 2009, 11:29:41 »
Hi!

Since my German is too weak, I'll write this in English and hope that it's ok anyway.

I'm using Oscat functions (a lot of them actually) in a project with a Siemens CPU315-2 PLC. It seems that there is a problem with the STIME function on this PLC, since the time dependent functions stop working intermittently. This is most obvious with the INTEGRATE function that makes big jumps in it's output at seemingly random times.

Does the TIME_TCK() function (which STIME uses) work differently on CPU315 compared to other Siemes cpus or am I missing something obvious here? If I edit the STIME function not to toggle bit 31, everything seems to work. But it seems strange that there would be such a serious bug in Oscat which is otherwise working almost perfectly!?

Any clarification of this would be great!

Best regards,
Martin

c3p0

  • Gast
Re: STIME overrun?
« Antwort #1 am: 12. März 2009, 13:11:14 »
After looking further into this problem it seems that it might originate in several subsequent calls to STIME.

If I change the order of the following lines in STIME the problem seems to disappear.

"Correct" order:

(* stuff the highest bit into the timer value *)
at_tx[7] := bit31; 
 
(* remember the last system time for the next overrun check *)
last_time := tx;

If the "last_time := tx;" statement is executed before bit31 is toggled, then the bit can be toggle again the next time STIME is executed. This will give faulty timer values.

Still any comments or clarifications in this matter would be much appreciated!

/Martin


dalbi

  • Gast
Re: STIME overrun?
« Antwort #2 am: 12. März 2009, 20:59:06 »
hi Martin,

thank you for feedback. i think the problem exist only on older simatic cpus. STIME is testet under simatic plc-sim, it works correct.
in the next release the function is changed.

thank you!

best regards
Daniel