Technical Forum

STEP 7 (TIA Portal)

self starting timer

Thread Starter: ATMega128   Started: 8/19/2012 9:16 AM   Replies: 2

« Previous thread Next thread »
Page 1 of 1 (3 items)
  8/19/2012, 9:16 AM
Joined 3/13/2007
Last visit: 5/13/2013
Posts: 16
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 

hi folks,

I'm new to SCL and having the following question : why isn't this working ?
The idea was to have a 1 cycle pulse each 100 msec ( StartTimer1 inverted)

IF NOT "StartTimer1" THEN "StartTimer1" := true;
END_IF;

"CurrTime" := S_PULSE (T_NO:=1, S:="StartTimer1", TV:=100ms, R:=False, BI=>"TimeRemainTimer1", Q=>"Timer1");

IF NOT "Timer1" AND "StartTimer1" THEN "StartTimer1" := false;
END_IF;


The timer runs once but doesn't restart again !!  StartTimer1 has a 0 to 1 transition !?!
Kind Regards

Johan

Top
  8/19/2012, 10:42 AM
Joined 2/17/2009
Last visit: 5/21/2013
Posts: 320
Rating:
Rated: Excellent [4.28 out of 5 / rated 25 time(s)]. (25) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Greetings

It is not working because timer starts on transition from 0 to 1 (false to true). You would need to make additional one-cycle pause before the first line... 

But anyway, there are better ways to do this. You can make OB that periodicaly runs every 100ms. Or use clock memory that changes every 0.1s. 

Best regards
Top
  8/19/2012, 8:59 PM
Joined 3/13/2007
Last visit: 5/13/2013
Posts: 16
Rating:
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Rated: no ratings [0 out of 5 / rated 0 time(s)]. (0) 
Thank you for the info, and yes i already switched to the clockmemory and now i got my 100mse 'tick'
Top
Thank you for this post from:
Page 1 of 1 (3 items)
Actions