[?]: Hourscounter in S7-300

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
Scarch
Posts: 103
Joined: Fri Aug 31, 2007 8:17 pm
Location: Europe

[?]: Hourscounter in S7-300

Post by Scarch » Tue Jun 15, 2010 3:21 pm

Hi all,
I used to use the SFC101 as a machine hourscounter, but I have seen that everytime the counter is restarted, the minutes go to zero, so it is totally useless, as it only counts entire hours.
I liked that because it is stored in eeprom.
Is there any other system block a little more serious to count the production time including minutes?

sventek
Posts: 56
Joined: Sun Jul 13, 2008 10:48 am
Location: Europe

Re: [?]: Hourscounter in S7-300

Post by sventek » Tue Jun 15, 2010 7:59 pm

Hi Scarch!

Look at Siemens entry ID: http://support.automation.siemens.com/W ... en/5504548
How do you count the runtime elapsed for more than 8 resources?
Greetings
sventek

Scarch
Posts: 103
Joined: Fri Aug 31, 2007 8:17 pm
Location: Europe

Re: [?]: Hourscounter in S7-300

Post by Scarch » Thu Jul 08, 2010 9:56 pm

Thanks !!

Arimateia
Posts: 1
Joined: Tue Oct 20, 2009 7:23 pm

Re: [?]: Hourscounter in S7-300

Post by Arimateia » Fri Jul 09, 2010 3:22 pm

Hi Scarch!

I have used this function: :anon:

Code: Select all

      A(    
      A     M    352.2  //auxiliary command enabled
      A     M      8.0   //machine running
      )     
      JCN   C002
      AN    M      6.5  //1 second tick positice edge
      JC    C002

      L     DB26.DBD   74 //running time since 
      L     1
      +D    
      T     DB26.DBD   74

      L     3600
      /D    
      T     DB26.DBW   82 //running time since - hours

      L     DB26.DBD   74
      L     3600
      MOD   
      L     L#60
      /D    
      T     DB26.DBW   84  //running time since - minute

      L     DB26.DBD   74
      L     60
      MOD   
      T     DB26.DBW   86 //running time since - second
I hope have been useful

best regards

Arimateia - Brazil

sanruku
Posts: 66
Joined: Tue May 12, 2009 9:50 am

Re: [?]: Hourscounter in S7-300

Post by sanruku » Sat Jul 10, 2010 9:45 am

If you use clock memory, bit 5, it has a period of 1 second. When you detect a rising (or falling) edge in that particular bit, you can increment a counter (dword maybe) by one. So, this counter is counting seconds, up to a maximum of
4294967295 seconds = 136.102208 years. (Even if you don't want to use in hex, even in signed double integer you get half of it: 68 years)

Looks enough to me.

Code: Select all

      SET   
      A     M    255.5 // clock memory byte M255
      FP    M    120.0 // auxiliary bit for rising edge
      JNB   _002
      L     L#1
      L     MD   122   // this is your counter
      +D    
      T     MD   122   // your counter again
_002: NOP   0

Variations include using interrupts to do the same thing, by a second, minute, anything you like...

Hope this helps

Scarch
Posts: 103
Joined: Fri Aug 31, 2007 8:17 pm
Location: Europe

Re: [?]: Hourscounter in S7-300

Post by Scarch » Thu Jul 15, 2010 11:18 pm

The idea was to use the integrated clock (as it is stored on EEPROM and can be deleted only by software), but thanks anyway. Besides, I've been checking the SFC101 and it does not discard the minutes as it seemed

Post Reply