Newbie question

I'm assuming you are talking about Siemens.
A Data Block is a file that is used generally for holding data but can be used just like any variable, it contains variables that can be words, double words, bits, bytes (integer, dinteger, Float bool), this is like the other variables in other platforms i.e. N7:0 F8:0 (AB) MWxx, Omron, Dxxx (Mitsubishi), the main difference is a Data block in Siemens is not available in the PLC, it has to be created, i.e. instead of fixed variable tables you create a DB, give it the length and can be formatted for all above variable types.
When referencing a variable in a DB you call the data block number before using the variables in it, i.e. Call DB10, Load DW23, however, it can also be referenced as DB10.DBW23, There is a difference depending on what programming IDE you are using TIA or the older S7.
A program block is just a block of logic like any program for example a ladder block, a Function block is essentially the same but you can pass data to/from it, the code in a function block can be re-used many times in two ways either as many instances or as a single instance (single instance means the variables are passed to the function block, the FB is called, does the logic (code) then passes any variables back to the calling program, so for a single instance the block can be called many times from many program blocks but it is only one instance, however, multiple instances generates a separate block of code for each call).
So in essence you create a standard function (AOI in AB money

I'm fluent in S5 & S7, however it has been a number of years since I have used TIA and DB's can be referenced in a different way so perhaps others on here can explain it better if you have TIA.

I strongly suggest you watch some vids on you tube on Siemens.
It can be complex to understand and too lengthy to explain here.
 
I'm assuming you are talking about Siemens.
A Data Block is a file ...

@parky is correct, of course. The one thing I would like clarify is that a "file," in the context of PLC programming, is a fixed-size(?) area of memory.

Specifically, for those (like me) who come from a different (non-PLC) computer domain and are (or were, like me) confused by the word, it is not a "file" in the sense of a filesystem-based operating system (Linux, Windows, OS X, DOS, etc.), where a program typically

  • opens an existing file or creates a new file,
  • reads data into memory from the opened file, and/or
  • writes from memory into the opened file, which may change the size of the file, and finally
  • closes the file.
How a PLC-file is created, or whether it needs to be, and which parts of the program have access to it, are all topics for another day.
 
DR: Actually in Siemens terms they are files, the DB's are not fixed memory neither are the PB's, FB's, Siemens is a bit different in that they use a type of file system similar to a HD, the blocks are written to spare memory, at the end or before the beginning of program scan the new blocks location is placed in like a FAT table & the old location deleted (not too sure if S7 is like this now but suspect it is), the introduction of S5 some years ago, after a number of downloads of blocks the memory had to be compressed to make room for the newer blocks, later versions of S5 did this automatically, the reason for this was the old blocks were not deleted just the file position was replaced with the new.
This is the reason Siemens was capable of downloading the whole program while in run mode & on-line changes could be much larger than most PLC's.
DB's in S5/S7 could be as big as available spare ram for the program, it was also possible to generate a DB with PLC code as big as the spare memory. Not sure this is still true with TIA as new standards for variable data needs to conform to certain standards.
 
DR: Actually in Siemens terms they are files, the DB's are not fixed memory neither are the PB's, FB's, ...




First of all, thanks for the background: it explains a lot about how Siemens works under the bonnet, which is always useful.


Second, I said fixed-size memory, not fixed in memory.



That said, in that case Siements PLC file are equivalent to memory-mapped files from the filesystem-based OS world, but they are still indistinguishable from memory to the user-supplied program.


My point is that the user-supplied program code neither opens nor performs file-reads nor performs file-writes nor closes nor memory-maps the files itself; it simply accesses the data in them via pointers to memory, using the memory mapping which occurs behind the curtain.


The overall point I was making is that all communication is by analogy, and so, speaking from experience, using the word file can confuse people who carry a pre-existing and different concept of the word "file" into the discussion, and may not be aware that an explanation is attaching a different concept to that same word.


My personal history across many different technologies is that learning in a new domain is usually straightforward once that new domain's jargon is understood, because they are all usually doing the same things while using different, often conflicting terminology.
 
Err.. yes The file allocation system is not exactly like a HD, it does not need to open & close it it just accesses it. The program memory (well in old S5/S7) was the same so for example 64k, So i believe any block could be located anywhere within that memory, I'm not completely sure but believe it is segmented, however, if you do not use any DB's then it leaves plenty of memory available for program & function blocks so I can only assume this is how it works, It is some time since I used Siemens, I do remember doing a project where I needed to create a DB very big to hold information on production, this acted like a buffer for a printer just in case they ran out of paper, In the start up OB I checked the spare memory, generated a data block as big as memory left minus enough to download the largest block in the program to allow an on-line change, this block was only generated if it did not exist, the reason for this was to maximise the buffer but allow an on-line change, the problem was you had to delete the whole memory if you wished to download the complete program & if you took a copy of the generated DB then downloaded it, it would not have enough memory as it needed load memory spare.
 

Similar Topics

Howdy folks. Been doing PLC programming for like 15 years now in LD and ST, but I'm trying to learn SFC now and have a kind of dumb question... I...
Replies
4
Views
1,426
Hello. New to Unity and had a couple quick questions. Can a Modicon M340 output to a small multiline LCD screen and not a full HMI?
Replies
4
Views
969
Hi. I'm learning AOI programming in RSLogix 5000. I created an AOI with several input and output parameters but when I choose the AOI in the main...
Replies
17
Views
3,295
Good morning, I've had an inverter fail with firmware revision 5.002, the only spare is Rev 7.001, when updating the project with the new...
Replies
2
Views
1,268
Oh, I hope someone can help! I have one little problem holding me up from studying this weekend. I'm using Rslogix micro starter light, it's a...
Replies
7
Views
3,006
Back
Top Bottom