Reset all set markers when CPU stopped

mahmoud turky

Member
Join Date
Oct 2009
Location
Cairo
Posts
30
Hello all,
Can anyone tell me an easy way to reset all set markers and datablocks when i stop the CPU?
I'm using CPU SIEMENS 314.
Please anyone help me.
Thanks
 
Example how to reset a DB..

Code:
FUNCTION FC_ResetDB : VOID
TITLE =Blocket nollar en DB

AUTHOR : HP
NAME : ResetDB
VERSION : 0.1


VAR_INPUT
  DB_Nr : INT ; 
END_VAR
VAR_TEMP
  anyDest : ANY ;  
  iRetur : INT ; 
  wLength : WORD ;   
  bW_Prot : BOOL ;   
  iNoll : INT ;  
  wDB_num : WORD ;   
END_VAR
BEGIN
NETWORK
TITLE =

      L     #DB_Nr; 
      T     #wDB_num; 


NETWORK
TITLE =Check DB lenght

      CALL SFC   24 (
           DB_NUMBER                := #wDB_num,
           RET_VAL                  := #iRetur,
           DB_Length                := #wLength,
           WRITE_PROT               := #bW_Prot);
      NOP   0; 
NETWORK
TITLE =Check for errors (no db or write protected)


      O(    ; 
      L     #iRetur; 
      L     0; 
      <>I   ; 
      )     ; 
      O     #bW_Prot; 
      JC    Fel; 
NETWORK
TITLE =Make ANY pointer to DB

      L     B#16#10; // Alltid 10h vid Step7
      T     LB     0; 

      L     B#16#2; // Byte
      T     LB     1; 

      L     #wLength; // Length
      T     LW     2; 

      L     #DB_Nr; // DB nummer
      T     LW     4; 

      L     B#16#84; // DB
      T     LB     6; 

      L     B#16#0; // Bit & Byte adress
      T     LB     7; 

      L     W#16#0; // Bit & Byte adress
      T     LW     8; 
NETWORK
TITLE =Create a zero to use with the fill instruction

      L     0; 
      T     #iNoll; 
      NOP   0; 
NETWORK
TITLE =Reset the DB

      CALL SFC   21 (
           BVAL                     := #iNoll,
           RET_VAL                  := #iRetur,
           BLK                      := #anyDest);
      NOP   0; 
NETWORK
TITLE =

Fel:  SET;
      SAVE; 

END_FUNCTION
 
You could also set the Datablock properties to non retain and adjust the number of retentive merkers to 0 in the hardware configuration
 
The OP states he wants the markers and DB's reset when he stops the CPU. No mention of restarting. Is this what is really required ?
 
Both the above mentioned solutions will reset markers/db when the plc goes from stop-->run not run-->stop. I dont know any good solutions to handle all cases when the PLC goes from run-->stop. Some of the cases can be handled by error handling OB's but I'am not sure if that covers it all. Maybe someone else knows.
 
Last edited:
As far as I know, when the CPU stops, it stops. That means it can't do any more instructions. Therefore you cannot reset values whn the CPU stops. The only, and already suggested, solution is to reset values when the CPU starts again.

Kind regards,
 
As far as I know, when the CPU stops, it stops. That means it can't do any more instructions. Therefore you cannot reset values whn the CPU stops. The only, and already suggested, solution is to reset values when the CPU starts again.
To add to this:
When the CPU is stopped, markers and datablocks are not accessible anymore, so what is the use of resetting them at a run-stop transition if they are only accessible after a restart :confused:
 
To add to this:
When the CPU is stopped, markers and datablocks are not accessible anymore, so what is the use of resetting them at a run-stop transition if they are only accessible after a restart :confused:

He might have his reasons OPC,HMI third party apps etc can still access data from the CPU even though its in stop. If thats the case then other solutions like life bits might be easier to implement.
 

Similar Topics

I was loading a program onto an XE1e2 PLC and it got stuck on these two windows and won't progress. It won't let me connect from the PC to reload...
Replies
0
Views
62
Hi all, i have recieved some 4RF Aprisa SR+ ethernet radios from a customer to configure. Issue is that they are used and have non-default...
Replies
0
Views
64
Hi Guys, I have a 1769-L24-QBFCB1 that has the OK light flashing on the embedded counter module. The manual states it is a resettable fault, but...
Replies
0
Views
98
We are using RED LION HMI Since las 15 years. To day we have found that My log file has data up to 22 Mar 2024 1:16. Then After new Log File is...
Replies
22
Views
1,175
I'd like you to meet my IO_Link Block, Fred. There are a couple of SSVs outside of Fred's AOI whose main purpose in life is to prevent me from...
Replies
2
Views
140
Back
Top Bottom