This lesson is part of the Components and Property Binding course. You can browse the rest of the lessons below.


Autoplay Off


Learn how to use various input components (such as Numeric Text Field, Spinner, or Slider) and buttons (such as 2 State Toggle, Multi-State, One-Shot, or Momentary) to write values back to the database or PLC.

Video recorded using: Ignition 7.9


(open in window)

[00:00] When creating real time status and control screens, we often want operators to write back to the PLC using control components. Let's take a look at a few of the control components that come with ignition. You'll find all of them under the input and buttons tabs of the component palette. So let's start with the numeric text field. The numeric text field allows us to write to a numeric value in the PLC. If you look at the properties down here at the bottom left, the most important property in the numeric text field is number type. This dictates what type of value the operator can type in. And it could be an integer value, double, long, or float. So you want to make sure that you use the appropriate value down below based on the type. So if it's integer, I want to use integer. If it's double, I want to use double. So we can simply take a tag. Like I can take WriteableInteger1 tag, drag it around to the component, and you will see of course that it binds the value integer to the tag bidirectionally. So if I go look in the binding of course is bidirectional so I can write back to the PLC. Now it's going to work because the number type here is integer. So if go into run mode and I want to change the value to like 26, of course you'll see it write that back to the tag here. I cannot set that right now to 26.5 because it doesn't allow decimal places. It's an integer. If I took another numeric text field on the window, and I drag WriteableDouble1 onto it, you'll see that what happens is the number type changes to double and now we're binding the value double to it. This component does have a couple of extra properties like forcing user to enter a value between the bounds, and if they're out of bounds we can error on that. There's also properties for if you want it to editable and such. The next one is the spinner component. The spinner component allows you to modify a numeric value in the PLC, but it allows you to actually have operators that you can click up or down to spin the value up or down by some step size. So I can take, for example, WriteableInteger1, drag it around to the component, and I can go over here and set the numeric step size to whatever I want. Let's say I put this to a value of five, and now if I go to preview mode, I can actually spin this up by 5 every time as you can see, it's writing that value to the PLC. Another important component is the slider. This allows you to actually modify a set point very easily. So I can take a tag, drag it onto there, of course it's going to bind the value property of the component bidirectionally to the tag, and there's a couple of important properties here. By default, it's going to show this as a horizontal slider. There is a way at the bottom here to uncheck the horizontal slider to make it a vertical slider. Either way, we can actually just change the slider by moving around you'll see it's going to write that to the tag. Let's take a look at a couple of the buttons that ignition comes with. The first would be the two state toggle button. This is the button where we can actually toggle a value of the PLC between two different values. So for example, I can just take WriteableInteger2 tag, drag it on, and what it's going to do is it's actually going to bind the control and indicator value properties to the tag for me. So this component has two separate properties that we have to . The control value is the value that we're going to write to the PLC, the indicator value is the readback. Sometimes, the way you program PLC is you might have two different tags. One that you write to, and one that you read back. If you only have one value, you just bind both of these to the exact same tag, which is what I have here and the control value is bound bidirectionally because that's what you use to write back to the PLC. Now you'll see there's a step one and step two value, so we're going to toggle between these two and we're going to just basically based on the current state that we are at. So if I go to preview mode, and I go and turn it off, you'll see it's going to go to a zero in the PLC. If I put it to on, it's going to go to one. If I set the step one value to let's say 10, and the step two value to a 20, then I'm going to toggle between 10 and 20. So you can see now, you can see that it's going to go in the PLC as 10, and go back there as 20. And we can configure what we want this to look like by going right click and going into the style customizer and we can specify how you want the colors and the text to look like for those different states. The next one is the multi-state button, which is like a two state toggle button but allows you to do more than just two states. You can right click on the component and go down to customizers, multi-button state customizer to add states that you want. So here I have HOA, which is two, zero, and one, I can add multiple and change the colors for the states. Then we do a simply bind that to a tag. Again, it's just like the toggle button that has a control value and an indicator value property. We can take a tag, drag it onto the component, it'll bind both of those up for me and bidirectionally. So now I can actually go and toggle between these different states. I can only be in one of the states, though. And you can see that value written to the PLC. Another button we have is the one-shot button, this is a nice button where the operator can only press it once to write a value to the PLC, and it's going to wait for the PLC to reset the value before it comes back to life. So here for example if I take this WriteableBoolean1 tag and drag it onto the one shot button, basically it's going to set it to a one as a set value over here, so if I go and set it, you're going to see it's going to say writing and it's going to stay disabled here and tell the PLC value it's reset. So if I actually then go and uncheck this in the tag browser here, it's back to zero and you can see the button come back to life. So this is a way of only allowing the operator to press that button once and waiting for the PLC to acknowledge that and reset the value. The last one we'll look at here is momentary button. Momentary button or a timer button is one that will basically set the value in the PLC for a specific number of seconds. So I can drag a tag onto that. One will say I take this WriteableInteger4 tag, drag it over. Basically it has a couple of properties, the on value and the off value so one and zero, you can set that to whatever you want and it has a min hold time and a max hold time. So at min hold time here, I can set this to five seconds in that. If I go and press the button, it's going to hold a one in the PLC for at least five seconds. After five seconds, it's going to then write the off value, the zero back to the PLC as you see here. But the one cool thing about the component is if I keep my mouse down, the longer I keep it down, that it's going to keep a one in the PLC. So if it's past five seconds, it's going to keep a one in the PLC and after five seconds of course, if I let go, it's going to then instantly write a zero back to the PLC. So there's quite a few different components you can work with to write back to tags in the PLC.

You are editing this transcript.

Make any corrections to improve this transcript. We'll review any changes before posting them.