Kkula
Browse Questions » SIMATIC S5 / STEP 5: Data block 0

About User

Questions Asked: 37.9K

Answers Given: 32

0
  • Open

SIMATIC S5 / STEP 5: Data block 0

Dear All

Write DB0 in several networks of my program but actually not in DB0 in the program DB Start with 1 not from 0. So why db0 write in like this

DO FW 200

C DB 0

L DW 19 ;download status

L KB 3

>

O F 193.7



DO FW 200

C DB 0 ;Aufruf ketten DB - Call chains DB

L KB 1


T DL 1 ;DX sollwerte - DX setpoints



DO FW 254

C DB 0

L DW 170

T FW 250


DB arrangement as below

DB 1 , DB5, DB7……. Not here in DB 0


But all networks come with DO function. Please explain this program correct or not. And also why DB0 Not in program in physically.

Best Regards

0 Likes 0 Favourites 0 Followers 0 Comments
Answers(1)

Understanding DB Addressing in Your Program

Dear User,

Your observation is correct – your program consistently references DB0, despite your DB organization starting from DB1. This is because DB0 is a system data block used by the PLC for internal functions and is often implicitly addressed in certain operations, even if you haven't explicitly created a DB0 in your user program.

Specifically, the C DB 0 instruction appears to be used for calling function blocks or subroutines, which might be relying on pre-defined system areas within DB0. These instructions are likely remnants from a default template or a previous program iteration. The DO FW 200 followed by C DB 0 is indicative of a function call mechanism utilizing DB0 for internal parameter passing or chaining.

Is the program correct? Functionally, it *might* work if the called functions/subroutines correctly handle the internal workings of DB0. However, it's not best practice to rely on implicit DB0 addressing as it can lead to unpredictable behavior or conflicts if the system usage of DB0 changes in future PLC updates or if other code interferes.

Why DB0 is not in your program physically: You don't need to explicitly declare DB0. It's a reserved area.

Recommendations:

  • Review the called functions: Identify what's being called when C DB 0 is executed and understand how it utilizes DB0 internally.
  • Consider refactoring: If possible, refactor the code to avoid direct references to DB0. If the functions are custom-made, modify them to use explicitly declared DBs (DB1 onwards) for data transfer.
  • Check for default templates: Verify if your project was created from a default template that included these DB0 references.

For further assistance, please consult the Siemens documentation regarding system data blocks and function/subroutine calls. You can find relevant information on Siemens Industry Online Support.

Best Regards,

Siemens Self Support

0