An Introduction to Data Blocks (DB) in Siemens TIA Portal!

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
welcome back everybody to another scan time video and this week we're going to have a look at the introduction to data blocks using the siemens s7 1200 plc and ti-8 portal now a couple of weeks ago we were having a look at the data inside of the plc we had a look at data inside of the plc for siemens plc's and we also briefly touched on it inside of mitsubishi plc's now what siemens has inside of its plcs is what we call data blocks and data blocks are a fantastic way of structuring data inside of a program without the need to use things like memory bytes memory words and memory double words when we looked at memory a couple of weeks ago inside the siemens plc we realized that it can be extremely easy to overwrite data inside of the plc by overlapping our memory bytes memory words memory double words with data blocks we can actually overcome that problem and structure our data inside of a nice sort of like an excel file effectively inside of the plc and then that allows us to write information to our data block and pull information from our date block just like we would with a date and memory area now before we get into the video remember do hit the like button and subscribe to our youtube channel to stay up to date with more new videos and if you want to learn more about data blocks or the siemens plc click the link below which will take you to our website and we'll take you to our online course let's get into it now we've recently worked on a pressure testing system for a client and during that pressure testing system you can undertake three types of tests you can undertake a low pressure test a medium pressure test and a high pressure test each pressure test collects information from the real world and we store that information inside of the plc but where do we store it well in other plcs what you would do is you would usually store that inside of data memory areas so for example on run use dm registers or d registers mitsubishi usd registers inside of the plc siemens they have data memory areas as well we have memory bytes memory words and memory double words and we had a look at those a couple of weeks ago but we saw problems with that we can overlap data memory areas inside the plc fairly easily and corrupt date if we're not paying attention to our program so for example let's open up this notepad here and let's have a look at some information that i might want to collect from our high pressure test this is only just a small snapshot of the information that we would take so for example we would take the start time and the end time of the pressure test and that would be stored as a time data type we would then take the panel number which would be an unsigned integer because it's just 16 bits without any negative values so it's unsigned and we would take start temperature end temperature pressure end pressure and the average flow rate as well and they will be stored as like real values inside of the plc as well which are floating point values or decimal values and what we would do if we didn't have a data block is we would pick and choose data memory areas that we want to access and store this information in but ultimately there's no real structure to the actual program we would just pick and choose what data memory areas we want to access so for example if we were looking at our start time we might store that information inside of md100 and then our end time would be stored inside of md104 and we would just really just pick and choose data memory areas that we want to access but again ultimately there's no real structure to that we're just randomly picking areas and we've also got that problem of overlapping areas if we're not careful now what siemens also provides us with is data blocks and what a data block is is we can effectively create a data block and call it high pressure test we can then create another one called medium pressure test and low pressure test and what we can do inside of that data block is just like an excel document is we can create data areas inside of that data block and store information inside of those data areas and what that allows us to do is create some form of structure because we're creating like a data table to store all of this information inside of so let's have a look it's how we can create a data block inside of siemens this is just going to be an introduction date block so we're not going to go too in depth with it we're just going to set one up and see how we can write information to it and pull information from it if you want to learn more about data blocks and more about the siemens plc click the link below and that will take you to our siemens tia portal or siemens step 7 professional course where we cover data blocks in a bit more in depth manner so let's have a look at data blocks inside the plc let's minimize this currently we are opening up a siemens program and we are inside of ob1 the main block no code inside this is just a blank program if i go to add new block we are then given an option of what type of block we want to create and at the bottom left we can see that we've got data blocks if we just select data blocks we can then give this a name so for example i might give this the name high pressure test and you got a type of data block that we want to use and we're going to use a global data block which means it can be accessed throughout the whole program so any block inside of my plc program can then send information to this data block and then receive information from it so we can send information to it from when we're doing a high pressure test and we can receive information from it for when we might want to put that information onto a report and that can be then printed out by the operator next is choosing the data block number you can either select this manual and manually choose a data block number or you can select this as automatic and the plc will choose the next available data block number when we are creating data blocks like high pressure tests and low pressure tests there are blocks that we are creating to be used throughout the program we usually just select this as automatic and it will start from one and then progress steadily through two three four and so on timers and counters they also have their own data blocks assigned to them if you want to learn more about that go to our timers encounters video on our youtube channel and we talk more about data blocks on there now what i'm going to do here is i'm just going to say ok to that and what you will see on the left hand side is our data block become created high pressure test db1 and then it opens up like an excel document and this excel document consists of columns and rows and each row is a cell of data inside of our data block and each column then allows us to set up our data so to speak so for example as i mentioned we want to collect this information inside of our plc program instead of us just storing these inside of memory bytes memory words and memory double words what we would then do is we would store this information inside of this data block and it allows us to neatly structure our data inside of one nice usable file inside of our program so what i'm going to do is we're going to type in here start time for our name like so what we'll then do is we'll grab our data type and we'll change it from boolean because boolean is just true or false and we'll look down here and we should be able to see time of day and that will then display the actual time of day for our test when we send the information to it so we'll select time of day there and there we go there's our current time of day we can even set this to be retentive as well so if our plc powers off and we power it back on that information will then be stored so it will store the most recent information from our most recent high pressure test so let's just set that to be retentive what i'll then do is end time and that will also be selected as time of day we'll put in our panel number and that there will be an integer or an unsigned integer actually there we go that just means it's completely positive we will then store our start temperature and our end temperature and these are going to be real values oops real values like so we'll then have our start pressure and our end pressure and then what we'll also have a look at is the average flow rate as well and as you can see all i'm doing is i'm just filling this data block with technically names just names the data that we want the store so i'm just creating here a start time what the plc is now doing is it's now assigning a part of its memory to this high pressure data block db1 and then it's storing a part of that data block to start time now a great thing about ti portal is when you create a data block they become optimized unlike inside of step 7. what we mean by optimized is we don't need to have a look at its addressing it's all symbolic so here when i want to access this inside of the program i would simply just type out high pressure test start time and then that would then pick up that information from the plc memory area the plc would then do all the work in terms of addressing it we can make this unoptimized but we can set the addressing ourself but we will just leave this as optimized so we don't have to worry about the actual data block addressing now this is our data block now set up and i'll just change these to all retentive so if we power off the plc and power back on that information is then stored inside of the plc now if we go back to our main program we can then start pulling the information from the high pressure test we can then start sending information to the high pressure test so what we're going to do here is just very simple i'm just going to put a normally open contact here m0.0 and what we'll do is we'll use a move instruction just to send some data in so let's get our move instruction over here drag it over there and what i want to do is i want to send some information to our panel number okay so i want to access the panel number inside of my high pressure test so i'm going to send the value 1 to our panel number now to access our data block all we would do is start typing in the data block name high pressure test and you can see there the data block appears and then all we do from here is we then just select what type of data do we want to access so i want to access the panel number there we go so what's going to happen here is when i trigger m0.0 in the program one or any value is then going to be shifted into our panel number or panel number from what i've got here so let's just change that to panel number there we go now we're moving one into the high pressure test data block panel number what i could then do is i could then move let's say another value into our data block and i will move the value 12.0 and we'll move this into our high pressure test and another way we can access the data block is just by clicking this file it will then open up our available data blocks and there it is there high pressure test and let's say i want to send this to our start pressure there we go so when on trigger m0.012 is then going to be moved into my start pressure and what we'll do is we'll access another part of this data block as well and we'll just send the value 434.6 and we'll send this to our high pressure test once again and we'll access the um let's say average flow rate all right something crazy like that there we go so i've got a program now written where we trigger m 0.0 and we move values into our data block so let's just save that and then download that to the plc start all okay so let's just open up our high pressure data block here we can then monitor the information inside of our data block as well which is another useful feature because instead of us trying to monitor multiple memory words and bouncing between memory words inside of our program we can now just go to monitor all from here and we can just see all of the information that's inside of this data block and currently everything is zero so now if i go back to our main program and i just go to monitor this program block as well just minimize that and what i'll do is i'll then modify this to one and now you can see that we are now modifying this bit on and it's moving the values into our data block now if i go back to our high pressure data block we'll now see those values inside of our data block so we've now just shifted data from our main program into the data block and that's just now stored neatly inside of our data block ready to go and as i mentioned if i then just stop our plc say yes to that and then start again so yes to that the information is still inside of our plc so we've retained the information inside of there as well and like i said we can also move data around the program too so we can take data from our data block and then send it to another area inside of our program so let's just come offline here what we'll do is we'll just go offline on the whole project and i'm going to create another data block and we're just going to call this a test data block it's going to select this is date block 2. i'm going to say okay to that and what i'm going to do is i'm just going to call this test 1 test 2 test 3 and the first one is going to be a uint because that's what our panel number is and then the next two are going to be real values like so now what i'm going to do is i'm not going to let these be retentive these are going to be non-retentive so if we power off the plc power back on the information will then be lost so let's go back to our main program and what i'm going to do is in network 2 i'm going to add another contact and let's just call this m0.1 and what i'm going to do here is i'm going to move data i'm going to move data from our high pressure test and i'm going to move data from our panel number in the high pressure test and i'm going to move this to our test data block and i'm going to move this to test one i'm then going to branch down and do it again and this time i'm going to move our high pressure test start pressure and i'm going to move this to test test two and then i'm just going to copy this branch this down again and i'm going to move our high pressure end uh the average fluid sorry and i'm going to move this to test three inside of the program let's save that and then download that the plc okay let's go to our goggles now and that's right let's go back to our high pressure test so currently if you look at our high pressure test we'll see that the values are all still retained inside the plc that haven't disappeared so there's our 1 our 12 and our 434.6 so now what's going to happen is when i trigger m0.1 it's going to then move our information from our high pressure data block into our testing data block so let's then just trigger this memory bit and there we go so what we've now done is we've now had information sent to our high pressure data block we are then taking that information sending it to another data block in the program and that's now being stored inside of our tested data block so if we open this one up we can then see our information is now inside of our test data block let me go back to the main program let me just stop the plc say okay to that and then let's run our plc program say okay to that and then you'll see that our test data is now zeroed whilst our high pressure has still retained that information inside of it and that there is because this is retentive and this is non-retentive you can then choose certain bits or certain areas of the data block to also be retentive as well so we don't have to have the whole block to be returned we can just select different sort of data cells that we want to be retentive but that there is effectively data blocks in a nutshell like i say it stops us from having to constantly use things like memory bytes memory words and when we double words inside the program we can just create data blocks and have data related to a certain part of the process and then just send information to those data blocks inside of the program and then we can receive that information if we want to use it anywhere else inside of the program data blocks are a really powerful tool when you start to understand how they can be utilized inside the program it's a really nice way of structuring data without the need of using data registers so a lot of the times when you actually look at a program on the shop floor that's been using tia portal or step 7 you might see that memory words memory doubles and memory bytes aren't really being used as much we only use memory bytes memory words and memory doubles when we just want to send information to a singular data register and just capture that bit of information where we don't need to create a data block because there's not a group of data that we want to collect so that tends to be where we use when we bytes memory words remember double words but when we want to have a group of information a group of data that we want to collect and use throughout the program such as high pressure test low pressure test medium pressure test boiler temperatures or anything like that we can then store that information inside of the data block and it groups it nicely under one shell really powerful tool like i said it's just an introduction to data blocks we're not going too far in depth with these if you want to learn more about data blocks and learn more about unoptimized data blocks and how to utilize data block addressing and use data blocks inside of programs in a more advanced kind of way then what i would recommend you doing once again is click the link below it'll take you to our website and take you to our tia portal or our step 7 professional course depending upon which software package you want to use and then you can enroll on that course and learn more about the software package and data blocks really useful tool i'll see you again next time
Info
Channel: Scantime Automation & Training
Views: 3,473
Rating: undefined out of 5
Keywords: scantime, siemens, allen bradley, omron, mitsubishi, schneider, keyence, telemechanique, ge fanuc, plc, hmi, scada, programmable logic controllers, human machine interface, supervisory control and data acquistion, programming, ladder logic, structured text, instruction list, function, function block, data block, vat table, watch table, training, tia portal, step7 professional, rslogix 5000, studio 5000, rslogix 500, gxworks 3, gxworks 2, gx developer, syswin, cxprogrammer, sysmac studio
Id: OHaAsT5NcQo
Channel Id: undefined
Length: 18min 0sec (1080 seconds)
Published: Fri Mar 12 2021
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.