Version:

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

Supplemental Videos

LESSON

Control Components

Description

Learn how to use various input components (such as Numeric Text Field, Spinner, Formatted Text Field 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 8.1

Transcript

(open in window)

[00:00] When creating real-time status and control screens, we often want operators to use control components to write values to PLCs. Control components are the core of data entry in ignition and we will cover the most commonly used ones in this lesson. You can find the control components that come with ignition under the input and button tabs in the component palette of the designer. Let's start with the numeric text field. This component allows us to write a numeric value to a PLC and the value we can write is dependent upon the number type property. The type can be an integer, double, long or float so it's important to select the appropriate number type to match the value property binding. If I bind writeable integer one to the component, you'll see the correct value integer binding was created to match the integer number type. If I look at the binding, it is marked as bi-directional, so I can write integer values to the PLC tag with the component.

[01:02] For example, I'll go into preview mode and update the value to 25. However, if I try to enter a decimal value like 25.5, it does not get written because the value does not match the current number type property. We also have control over the value entered with the used bounds property. Enabling this property would enforce our value to be between the maximum and minimum properties. Additionally, enabling the error on out of bounds property would produce an error message when we are out of bounds. Looking at the rest of our components properties, we have other notable options. The defer updates property makes it so our numeric value is updated after hitting the enter key. Otherwise, the update would occur with each keystroke. Additionally, we can enable or disable editing on this component or disable it entirely with the protected mode. Let's move on to the spinner component. The spinner component allows you to modify a numeric value like a numeric text field would, and it allows you to spin the value up or down by some step size. The type of value that can be used is dependent upon the spinner mode property, which can be an integer, double, or date.

[02:08] For example, I can drag writeable double one to the component, and I can set the numeric step size to five. If I go into preview mode, I can actually spin this up by five every time, and you can see it's writing that value to the PLC. Let's move on to the next input component, which is the slider. This component allows the user to drag an indicator along a scale to choose a specific value within a given range and write back to the PLC. It uses only an integer type for its value and it's very easy to use. I can drag writeable integer two onto the component and go into preview mode to drag my indicator along the scale. You can see the value of the PLC will update once I stop moving the slider. This is because the defer updates property is also enabled on this component. The scale or range of the slider can be changed by altering the minimum and maximum values. If a value for the PLC is outside these bounds, an overlay will be applied to the component.

[03:03] The slider also has a few appearance properties we can change. Namely, we have disabling the horizontal slider property. Disabling the horizontal slider property will change the slider to a vertical orientation, and we can change the colors for the foreground and background and adjust the tick spacing. The final input component we will go over is the formatted text field. This component is a specialized text field used for alphanumeric text input that matches a specific pattern or format in a specific way. The format of the text depends on the validation mode, which can either be a regular expression or a formatted mask. A formatted mask user input is automatically formatted and restricted to a pattern. There are several commonly used formatted mask patterns to choose from, such as phone number percent or date. I will set the formatted mask pattern to a phone number and I can bind the committed value of the text field to writeable string one. If I go into preview mode, the formatted text field restricts my input to integers and it automatically formats my input around the special characters.

[04:08] This will write the formatted text to our writeable string one. Let's try a regular expression pattern next. First, I will assign the validation mode to a regular expression. The regular expression user input is validated against a special string that defines a set of allowed strings. There are several commonly used regular expression patterns like email address, IP address, HTTPURL, and more. Input that matches the regular expression is allowed and input that doesn't match is restricted. Regular expression is very complicated, so don't worry if you don't understand each of the sample patterns. I can set the pattern to a last, first name expression to see this in action. I'll provide incorrect input like some numbers and the tag value won't update because the regular expression is not looking for those numbers. Now, if I provide accepted input, then the writeable string one tag will update. We also have additional properties to allow invalid text and to commit values while typing rather than after hitting the enter key.

[05:04] Now that we've covered the common input components, let's move on to the control component buttons. The first button we will discuss is the two state toggle button. This component can be used to toggle a value between two states on a machine like on and off. It makes use of four values, control value, indicator value, and the two values that define the different states; state one and state two. Each time the two state toggle button is pressed, one of the state values is written to the control value. The indicator value property determines which state the machine is currently in. For example, I can take the writeable integer three tag and drop it onto the component. It's going to bind the control and indicator value properties to the tag for me. If I look at the control value binding, it is set as bi-directional, so if I toggle the button to an on state, the control value will update from a zero to a one. If I set the state one value to say 10 and the state two value to 20, then I'm going to toggle between 10 and 20. And we can configure what we want this button to look like by right clicking into the style customizer. We can specify how we want the colors and the text to look for those different states.

[06:11] The next button is the multi-state button, which lets you toggle between more than two states. You can right click on the component and go down to the customizers, then multi button state customizer to add the states you want. This shows three states for hand, off and auto with available configurations for their text and styling, and we can add more states with this plus button. If I bind writeable integer four to the button, we can see the state changes are written to the control value. Another button we have is the one shot button. This button allows the operator to only press the button once to write a value to the PLC, and then it waits for the PLC to reset the value before becoming available again. For example, I can drag this writeable boolean one tag into the button. And if I go into preview mode and click on the button, it will write a value of one to our tag setting this boolean to true. It will stay in the waiting or writing state until I reset the tag.

[07:06] The last button we'll look at is the momentary button. This button sets the value in the PLC for a specified number of seconds or however long the button remains held down, whichever is longer. The button uses a min hold time property that resets the value after a minimum number of seconds, which you can specify. Let's drag on writeable integer five to see this. I can set the min hold time to five seconds and go into preview mode to write to the tag. You can see after clicking the button, the control value that reads, our on value state was written to the tag for five seconds. Holding the momentary button longer than the min hold time will keep our value written to the tag and we can ensure our value is held for a maximum amount of time using the max hold time. So there's quite a few different components that you can work with to write values to PLCs.

You are editing this transcript.

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