A set bit in FC

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
azad_azida
Posts: 6
Joined: Wed Nov 12, 2014 8:40 am

A set bit in FC

Post by azad_azida »

Hi All,

I am working on a FC for a shut of valve and Star Delta Motor which later have a Set bit inside.
The FC later to be called in many parts of program. The Set bit is for Alarm/Trip signal to show the valve or motor is faulty.

The FC is called at few places, later i have update it for some reason, the Set bit become crazy where it ON and OFF once my FC is activated.
If the Set bit is changed with other bit, then it is OK. Once i put back the original bit, it goes crazy.

Is there any explanation? how can i fix the original bit?

Thanks.
azad_azida
Posts: 6
Joined: Wed Nov 12, 2014 8:40 am

Re: A set bit in FC

Post by azad_azida »

Here it is, i write in LAD and good in STL. M5.2 is Clock pulse.

Code: Select all

A     #Activate
      AN    #Valve_Trip
      =     #Valve_Close

      A(    
      A     #Valve_Close
      A     #Close_Lim
      AN    #Open_Lim
      O     
      AN    #Valve_Close
      A     #Open_Lim
      AN    #Close_Lim
      )     
      JNB   _003
      L     0
      T     #Trip_Counter
      SET   
      SAVE  
      CLR   
_003: A     BR
      JC    trp

 A(    
      A     #Valve_Close
      A(    
      ON    #Close_Lim
      O     #Open_Lim
      )     
      O     
      AN    #Valve_Close
      A(    
      ON    #Open_Lim
      O     #Close_Lim
      )     
      )     
      A(    
      L     #Trip_Counter
      L     10
      >=I   
      )     
      S     #Valve_Trip

      AN    #Valve_Trip
      A     M      5.2
      JNB   _004
      L     #Trip_Counter
      L     1
      +I    
      T     #Trip_Counter
_004: NOP   0

 JU    trp2

trp:  A     #Trip_Reset
      R     #Valve_Trip

    AN    #Valve_Close
      JNB   _005
      L     0
      T     #Trip_Counter
_005: NOP   0

trp2: A     #Close_Lim
      =     #Valve_Close_Visu


almaz78
Posts: 108
Joined: Tue Dec 16, 2008 7:36 pm

Re: A set bit in FC

Post by almaz78 »

without looking at your code.

Probably its because you are using temp variables in FC for variables that need to retain their condition for next scan (static area in FB)? but i could be wrong
azad_azida
Posts: 6
Joined: Wed Nov 12, 2014 8:40 am

Re: A set bit in FC

Post by azad_azida »

Sorry i am late as i am travelling.
Here is the link for the project.
http://www.datafilehost.com/d/9b9f7264

Hi Almaz, tq for your reply but i don't want to use a FB since it will have a DB for every call.
Every shut of valve i use will create a DB.