S7-1200 Fill db with 0

SIMATIC S7-200/300/400, Step7, PCS7, CFC, SFC, PDM, PLCSIM,
SCL, Graph, SPS-VISU S5/S7, IBHsoftec, LOGO ...
Post Reply
leres
Posts: 5
Joined: Wed Apr 03, 2013 11:03 am

S7-1200 Fill db with 0

Post by leres » Mon Jan 04, 2016 9:23 am

I used a really simple db deleting block in STL using SFC21 SFC24, Unfortunately siemens removed the stl support with s7-1200 and also there is no FILL_BLK using any pointer.
So, anyway i'm trying to make an SCL program with input of DB number and a byte which is used to fill the db with.

dehell
Posts: 104
Joined: Sat Jun 13, 2009 12:25 pm
Location: Europe

Re: S7-1200 Fill db with 0

Post by dehell » Mon Jan 04, 2016 9:24 pm

Hello,
you can find below an exemple.

Code: Select all

// DB number INT TO DINT
#Num_DB := INT_TO_DINT(#DB_NR);

// Write 16#0 for each byte of DB
FOR #i := #Start_Byte TO #Start_Byte + #Byte_Count BY 1 DO
  POKE(area:=16#84, dbNumber:=#Num_DB, byteOffset:=#i,value:=16#0);  
END_FOR;
Best regard

Post Reply