To learn more: https://www.AutomationDirect.com/Do-more-PLCs?utm_source=4RAAZalYOFI&utm_medium=VideoTeamDescription
(VID-DD-0088)
Explore the powerful Do-more Designer platform for programming BRX PLCs from AutomationDirect. In this video, we'll take a deep dive into Variables, Memory Organization, and User Data Types in Do-more. A great foundation for understanding what's going on inside of this innovative programming environment!
Check out the previous video on Memory, Data Types, and Structs: https://youtu.be/gPTWfv1ok6s
https://community.automationdirect.com/s/contactsupport?utm_source=4RAAZalYOFI&utm_medium=VideoTeamDescription
**Please check our website for our most up-to-date product pricing and availability.
In the previous video, we discussed PLC data storage, data types, and data structures in the Do-more platform. If you need to brush up on those topics, you’ll find a link to that video in the description below. The ability to create and deploy user data types is one of the most powerful tools available to a Do-more programmer. Drop down the PLC menu and select Memory Configuration. In the window that opens, we’ll find three tabs. From the Structs tab, click Add User Data Type and an Edit User Data Type Definition window will open. Let’s say we are working on a project that involves monitoring some temperatures from thermocouple inputs. We’ll make a data structure containing all of the variables involved with the temperature data. Add data fields with the Add button. First will be the temperature itself. Without spinning off into the how let’s take it that the temperature coming in will be a Real number, so let’s make that first. Name it Temp and assign it a real data type. We’ll leave this as a read-write and this is definitely one we’re going to want to show in both long and short formats in the data window. Display will be Native and let’s just leave memory layout as Automatic. What are we going to do with this temperature? Let’s say we are going to be assessing for a high temperature alarm condition and also triggering a warning at 80% of the alarm setpoint. We’ll also monitor for an open thermocouple and let’s say we’ll keep track of a peak temperature as well. In addition to the real number temperature field, we’ll need a real number alarm setpoint and a real number peak temperature. If the alarm setpoint is reached, we’ll want to trigger an alarm bit, but to avoid spurious alarms, let’s throw in a time delay. One of the remarkable things about Do-more user data types is that you can actually nest structures within your structure. Select Structure and in the drop-down menu, notice all of the types of structs we could use in here. We’ll select a timer struct. Let’s call it AlarmTimer. We’ll make another one for the Warning Timer. Next up, our bits. We’ll have a bit telling us whether the alarm condition is true, and one for the warning. We have an open thermocouple bit as well. We have 8 fields of various data types and we’ll be using 8 double words to contain each instance of this information. Visually, it looks like this, as we can see in the memory layout. So we have our own new user data type. Again, a data type is a definition or scheme that tells the CPU how to process a certain set of bits – a variable. Every variable in Do-more is assigned a data type, which means the CPU will automatically know how to process the data it contains. This is known as Strong Data Typing. How do we get from a data type to creating some of these actual variables? Finish up creating the data type by hitting OK here. A dialogue box offers a chance to create either a Heap Item or a Memory Data Block using the data type we just created. A heap item is a single instance of a variable of this type while a memory block is an indexable array of these variables. Let’s look at heap items first. Name the variable – Let’s call this TC, with a data type of thermocouple. A variable like this doesn’t need to be retentive, so uncheck that box. That’s it. We now have a single variable called TC. It is made up of 8 different elements, and those can be accessed individually in ladder logic or in a data window using the format (Heap Item Name) Dot (Field Name). As an organizational tool for your variables, this is obviously very handy, and perfect if you need just one instance of your new data type for your project. Notice you can have a maximum of 1024 heap items, including those built-in. But let’s back up. This time let’s pick Memory Block rather than Heap Item. This time the Add Block window pops open. We’ll stick with the name TC. We’re creating not one variable, but a whole block or array of variables, all of the same data type. In the block size input, we can define how big a block to allocate to our new array. Let’s say we’re going to be using 10 thermocouples in our project, so we’ll create a variable for each. Again, we don’t need these to be retentive. You can have up to 256 different memory blocks. Looking at the block range here, you can see that we are creating TC0-9 and this is how you’ll refer to these variables in your program. If we want to look at the alarm timer for our first thermocouple, for instance, we’ll look at TC0.AlarmTimer. TC1.Peak will give us our second thermocouple’s peak temperature and so on. What if you get into your project and discover that you’re going to have more temperature inputs than you thought? For that matter, what if you are working on a project and you find that the default allocations of the built-in memory blocks don’t match your needs? Say you need more timers than the 256 pre-allotted in the Do-more memory configuration. You need 400 timers. Well, that would be a lot of timers, but hey – it’s your project. To resize memory blocks or make any other changes, highlight the appropriate row and click Edit Memory Block. The edit window is much the same as the add memory block we looked at earlier. Here you can change the name, the block size, and the retentive range. Let’s change the T block’s size to 400. Notice that when we did that, the memory current size and space available changed accordingly. Imagine you need those 400 timers but you’re working in a project in your memory is maxed out. Just as you can increase the size of a memory block where needed, you can decrease the size of a block which is not being fully used, so you could free up memory for your timer block by decreasing the size of other blocks. You can reallocate the memory blocks any way you like, but obviously can’t go over the max size here. With powerful user data types and a completely customizable memory configuration, Do-more designer is one of the most dynamic and flexible PLC platforms out there, and we are just scratching the surface. Learn more about Do-more programming and BRX PLCs at AutomationDirect.com. Click here for more Do-more videos. Click here to subscribe to AutomationDirect’s YouTube channel.
Voted #1 mid-sized employer in Atlanta
Check out our
job openings