Siemens Load DB Number

cjd1965

Lifetime Supporting Member
Join Date
Apr 2007
Location
UK
Posts
1,659
Hi I am looking at a FB written by someone else

there is the code

Code:
L     DINO
T     #DBNB
OPN   DB [#DBNB]

I understand this is reading the DB number from the ACC and copying it into the variable DBNB and then opening the DB with the number DBNB...

My question is "why?" I always access the DB directly because it is related to the FB to which it is assigned.

I assume I am missing something very clever
 
Only Instance DB's are assigned to FB's.

Global DB's are not assigned to FB's.

A typical use for indirectly accessing a global DB, could be communications, where different links are assigned to different DB's or recipe's, many different reasons.
 
Hi all
I have revisited this... the DB's are instance ones. I will lost 1 FB and its DB later. I cant see that the access other than normal is used.
 
My guess is that at some stage the FB's interface was out of date and the code was giving unexpected results. The programmer decided to write to the instance DB using a hard coded address and then put the jump in to disable the write. The interface was updated and the instance DB regenerated and everthing started working. The debug code was never removed.
 
Hi Thanks for the reply. I realise there are are so may solutions but this style is used in almost every FB... sometimes there are writes to bytes for string access but it just seems redundant in most cases. Most blocks don't have the unconditional jump
 

Similar Topics

Hey guys, I have to take an upload of a program on an S71200 PLC to change a hardware config option and then redownload the program with this...
Replies
3
Views
104
Under PLC tags it shows there is a discrepancy with a lower level component via the orange exclamation mark. Yet there is no Blue/Orange under the...
Replies
3
Views
564
Hi All, I'm new to Siemens PLCs. I have a device that have a Siemens 1515SC IPC ruining the control and HMI applications, its documentation...
Replies
8
Views
1,672
I am new to siemens and I am trying to backup program from a S7-1200. Firstly I tried to connect using TIA Portal V16, then it shows the program...
Replies
15
Views
2,104
Hello, Hoping you guys could help solve an issue I'm having with a Siemens KTP1200 Basic HMI. I've been onsite for a few days making changes and...
Replies
2
Views
640
Back
Top Bottom