Siemens S7 Retentive On-Delay Timer

The Siemens S7 PLCs have five different timers in the regular instruction set yet it is missing a standard retentive on-delay timer. There is one called a Retentive On-Delay S5 Timer (S_ODTS) and its coil counterpart (SS) which provide a function to continue timing even when the timer is disabled. What we are looking for is something like Allen Bradley's RTO instruction that stops when disabled, retains the accumulator value and then starts where it left off when enabled again. This is very handy for keeping track of elapsed times.

Certainly we are not the first who've wanted this in a Siemens PLC. So where is it? Lo and behold, it is in the Function Library. FC80 in the TI-S7 Converting Blocks provides exactly the functionality we are looking for.

Drag and drop the function on a network and download FC80. It looks like this:

The STL version looks like:

      CALL  "TONR"
       TMR_EN :=I0.0
       RESET  :=I0.1
       PV     :=L#100000
       DELTA_T:=#OB1_PREV_CYCLE
       Q      :=Q0.1
       ET     :="Timers".ExampleET

The parameters are as follows:

Parameter Description
TMR_EN Enables the timer
RESET Resets the timer, ET goes to zero
PV Preset value in milliseconds
DELTA_T Scan time from previous cycle to add to ET
ET Current value of elapsed time in milliseconds
Q When the elapsed time is equal to or greater then the preset value then Q is on

The trick here is the DELTA_T input. The timer uses this value to determine the time difference since it was last scanned therefore the function call has to be in a block with a repetitive nature such as OB1 or one of the cyclic OBs. When in OB1, use the interface value #OB1_PREV_CYCLE (OB1s previous cycle time in milliseconds) for DELTA_T.

What is Under the Hood?

If you want to implement your own retentive timer with some added functionality here is the basic code.

// If RESET = 1 then reset the timer by setting Q and ET equal to 0.

      SET                          // RLO := 1
      A     #RESET                 // if(RESET = 1)
      JCN   IF01                   // {
      L     0                      //   ACC1 := 0
      T     #ET                    //   ET := 0
      CLR                          //   RLO := 0
      =     #Q                     //   Q := 0
      JU    EXIT                   // }

// If TMR_EN =1 AND Q =0 then accumulate time by adding DELTA_T to ET. 
// Otherwise, exit function.

IF01: CLR                          // RLO := 0
      L     #ET                    
      L     #PV
      = PV then set Q = 1, otherwise, exit function

EX1:  L     #ET                         
      L     #PV                    //     ACC1 := PV ; ACC2 := ET
      CLR                          //     RLO := 0
      =     #Q                     //     Q := 0
      >=D                          //     IF(ET >= PV)
      JCN   EXIT                   //     {
      SET                          //       RLO := 1
      =     #Q                     //       Q := 1
      NOP   0                      //     }
      NOP   0                      //   }
      NOP   0                      // }

// Exit function successfully by setting the BR bit to a 1.
 
EXIT: SET                          // RLO = 1
      SAVE                         // BR = RLO               

( categories: )

i wonder i i can have a plc

i wonder i i can have a plc in my room :-)

I have a requirement of off

I have a requirement of off retentive type off delay timer in s7- 300 portable generators review please kindly help me

We like this material. It's

We like this material. It's helpful and I can even mark it at a high standard of thinking of best term paper from http://allfreepapers.blogspot.com. We are satisfied with its concern.

Retentive Off-Delay Timer

Dear Sir
I have a requirement of off retentive type off delay timer in s7- 300 plc kindly help me.

Thanking You
Vivek Kumar Jha