«For Classroom Use Only! Important User Information This documentation, whether, illustrative, printed, “online” or electronic (hereinafter ...»
would find that the following conditions must be met in order for a Project Value to be downloaded to a variable:
Variables with both a Project Value and an Initial Value will be initialized with their Initial Value.
7. In this lab, we have a new project and none of the variables have a Project Value assigned to them yet.
Therefore, just click Download.
8. The download will proceed. When the download is complete, you will be prompted to put the controller back in Remote Run mode. Click Yes.
9. Notice the message in the lower left-hand corner that indicates that the Download has completed successfully.
In this section, we will demonstrate how to debug your Micro850 program. By debugging your program, you can view your program visually in real-time and watch values change in the program, as well as visually debug your Ladder Logic or Function Block Diagram.
1. Click the “Play” button in the Toolbar at the top of the workspace environment. This will put your program into “Debug” mode.
2. You should see the Ladder Diagram change color. The rung will turn blue, and any Boolean instructions that are active will turn Red.
4. Turn and release the DI0 switch on the Demo box. Notice the _IO_EM_DI_00 Direct Contact instruction turn red as you turn on the switch, and then turn blue as you release it (if you turn and release the switch too fast, you may not see it update in the ladder diagram). Then notice the _IO_EM_DO_09 Direct Contact and Direct Coil instructions turn red. You should also notice that the motor is running.
This is a typical motor seal-in circuit (and can also be applied in non-motor circuits as well). The Output Coil is turned on using a Direct Contact and then the active state of the Output Coil seals in the circuit. The circuit is unsealed when a Reverse Contact (normally closed) is opened.
5. Turn and release the DI1 switch on the Demo box to turn off the output. Notice the motor decelerate to a stop and the corresponding changes in your Ladder Diagram.
6. So far, you’ve debugged your program primarily by viewing real-time changes in the Ladder Diagram editor. In some instances, you may just want to view the real-time changes in a list format. You can do this by looking at the Variables list.
Since the variables we’re working with right now are embedded I/O points, we need to open the Global Variables list.
The Global Variables pane is a list of all the Global Variables in your program. You will learn more about Global Variables and other types of variables in the next section.
8. Locate the _IO_EM_DO_09 embedded I/O variable in the Global Variable list, and notice that the logical value checkbox is empty.
10. Turn and release the DI1 switch on the Demo box. Notice the checkmark go away in the logical value for _IO_EM_DO_09, and the motor decelerate to a stop.
Being able to debug a program in real-time is a very valuable tool in the programming and troubleshooting process, and Connected Components Workbench makes this design step very easy.
In this section, we will discuss what a Variable is, and the different Data Types available.
A variable is a unique identifier of data. A basic example of a variable is what you’ve already been referencing in the lab for Embedded I/O points. The Embedded I/O variables are Boolean data types that are direct references to the embedded input and outputs on the controller. They are identified by variables that start with the prefix _IO_EM, and are globally scoped. We will discuss variable scope a little later.
Micro800 controllers also have System Variables of varying data types that reference internal system values of the controller that a user may want to use in their programming, or for troubleshooting purposes. System Variables start with the prefix __SYSVA. An example of a system variable that is commonly used is the __SYSVA_FIRST_SCAN variable. This is a Boolean variable that is TRUE when the Micro800 controller is going through its first scan of the program – typically used for programming startup routines.
32 of 88 User variables can be created dynamically as you need them, and they can be named anything you want (as long as it’s not a reserved name). You can also create variables for local program use only, or you can create them for global use (for all programs to use) – this is what we refer to as variable scope. Global Variables are created in the Global Variables list, and Local Variables are created in the Local Variables list of the specific program.
Being able to create variables dynamically and use custom names provides you, as a programmer, great flexibility and customization that will help you create code and troubleshoot faster. Data types When you create a variable, you have to specify its data type. A data type defines the type of data that the variable represents, such as an integer, real (floating point), Boolean, time, double integer, etc. Data types can also be data structures of an Instruction Block.
CCW supports the 19 elementary IEC 61131-3 data types below.
• BOOL: Boolean, True or False
• SINT: 8-bit signed integer, range -128 to +127
• USINT: 8-bit unsigned integer, range 0 to 255
• BYTE: 8-bit unsigned integer, range 0 to 255
• INT: 16-bit signed integers, range -32768 to 32767
• UINT: 16-bit unsigned integers, range 0 to 65535
• WORD: 16-bit unsigned integers, range 0 to 65535
• DINT: 32-bit signed integers, range -2147483648 to +2147483647
• UDINT: 32-bit signed integers, range 0 to 4294967295
• DWORD: 32-bit signed integers, range 0 to 4294967295
• LINT: 64-bit signed integers, range -9223372036854775808 to 9223372036854775807
• ULINT: 64-bit unsigned integers, range 0 to 18446744073709551615
• LWORD: 64-bit unsigned integers, range 0 to 18446744073709551615
• REAL: 32-bit floating values, range -3.40282347E+38 to 3.40282347E+38
• LREAL: 64-bit floating values, range -1.7976931348623157E+308 to 1.7976931348623157E+308
• TIME: 32-bit words, range 0 to 1193h2m47s294ms
• DATE: 32-bit words, range 1970-01-01 to 2038-01-18
• STRING: Up to 252 characters, can contain ASCII codes from 0 to 255
In this section of the lab, you will learn how to create variables for use in your program. The variables you create in this section of the lab will be used in the next section of the lab.
1. Double-click Global Variables in your Motor_Circuit program to launch the Variables panel.
2. Scroll to the bottom of the list and create a variable called Motor_On_Time of Data Type TIME and press ‘ENTER’.
3. Create a variable called Motor_On_Time_ms of Data Type INT with an Initial Value of 5000.
A TON data type is actually the data structure of a Timer-ON-delay Instruction Block. We will discuss Instruction Blocks in the next section.
5. Create a variable called Start_Motor of Data Type BOOL and press ‘Enter’.
6. Create a variable called Stop_Motor of Data Type BOOL and press ‘Enter’.
An Instruction Block is essentially a function block that has been predefined to perform a specific task or function.
Instruction Blocks include functions such as timer-on-delay, timer-off-delay, math instructions, data-type conversions, motion instructions, and so forth.
In this section of the lab, you will learn how to implement a Timer-ON-delay Instruction Block (TON). This instruction block will be inserted into your motor circuit and will automatically turn off the motor coil after it has been running for five seconds.
You will also learn how to implement an ANY_TO_TIME data conversion Instruction Block to convert an Integer to a Time value.
1. Click on the Motor_Circuit-POU tab to return to the ladder diagram.
2. Drag-and-drop a Branch instruction around the coil instruction.
3. Locate the Instruction Block instruction in the Toolbox.
5. The Instruction Block Selector will appear. This is where you can select the type of Instruction Block you would like to use. As you can see, there is a long list of different types of instruction blocks that you can choose from.
Feel free to take a minute to scroll through this list to see what types of instruction blocks are available.
6. Since we want to use a Timer-On-Delay instruction block, type TON in the ‘Search’ field. This will filter the
7. Select the TON Instruction Block – this is the Timer-ON-delay. Then select the Instance combo box pull-down, and select the variable instance, Motor_Timer that you created in the previous section, and click OK.
9. Next, hover the mouse cursor over the red box area next to the PT parameter of the Motor_Timer TON instruction. You will notice a light blue highlighted box appear.
10. Click this box, and a pull down combo box will appear. Find and select the variable Motor_On_Time and then press the Enter key.
12. Insert another Reverse Contact after the _IO_EM_DI_01 Reverse Contact, as shown below.
13. The Variable Selector will display. Select the Global Variables – Micro850 tab. Click on the first cell in the last row to display the remaining non-BOOL User Global Variables.
14. Expand the variable Motor_Timer and select Motor_Timer.Q, which goes TRUE as soon as the timer’s Elapsed
19. Insert an Instruction Block instruction into the rung you just created, type ‘any_to_time’ in the search field and select the ANY_TO_TIME Instruction Block. Then click OK.
23. The ANY_TO_TIME instruction block is being used to convert an integer value into a time value that is used as the preset time for the Motor_Timer. The integer value represents time in milliseconds.
24. From here, you will assign two variables as a set of parallel inputs to start and stop the motor. This will be used for the PanelView Component HMI Design lab in the later section.
Create another parallel branch on the far left of rung 1.
31. After completing the download, put the program into Debug mode by clicking the Play button (or pressing F5).
32. Now test your program. Turn the DI0 switch on, watch the motor run for 5 seconds and then decelerate to a stop.
33. Change the value of the variable, Motor_On_Time_ms. Double click the variable box in debug mode to launch the Variable Monitoring window.
34. Change the amount of time the motor runs to 10 seconds (remember to enter the value in milliseconds). Make sure to press ‘Enter’ after changing the value.
35. Now test your program again. Turn the DI0 switch on and off. The motor runs for 10 seconds and then decelerates to a stop.
36. Close the Variable Monitoring window and click the Stop button to exit Debug Mode (or press Shift+F5).
37. You have completed this section of the lab.
1. Double-click your Micro850 controller in the Project Organizer to make sure you are displaying the controller configuration window.
2. If your controller is connected, click the ‘Disconnect’ button.
10. Locate the variable _IO_P2_AI_00. This is the raw data value in relation to the voltage that is wired to Channel 0 of the plug-in module. The value should range from ~0 to 65535 in relation to a 0 to 10 volt input.
11. On your demo box, turn the potentiometer labeled Speed Command and notice the value of _IO_P2_AI_00 change.
12. Stop debugging by clicking the Stop button, or by pressing Shift+F5.
13. You have completed this section of the lab.
About This Lab Now that you've learned the basics of creating a Micro800 program, let's create a PanelView Component application that will work with it.
Add the Terminal and Setup Communications Add a PanelView Component terminal to project and then configure the application.
1. From View Device Toolbox, expand Catalog and Graphic Terminals to bring up the list of PanelView Component HMI catalog numbers. Double-click on 2711C-T6T to add it to the Project Organizer.
2. Double-click the Graphic Terminal (Labeled as PVcApplication1) icon in Project Organizer to bring up the PanelView Component device configuration screen.
4. Leave the rest of the communication settings at the default state. Notice that the name of the controller we will be using is PLC-1.
5. Rename the PVcApplication1 as “MotorStarter” by right-clicking on the icon and selecting Rename from the menu.
56 of 88 Create and Use Tags This application uses read and write tags to define how objects interact with the addresses of the Micro850 controller.
You must create these tags before you can assign them to the objects in the application. Only objects that interact with the controller require a tag. Objects such as screen navigation buttons, drawings, and screen text do not require tags.
1. Double-click on the tags icon to open the Tag Editor.
2. Verify that the External tab is selected.
3. Click the Add button to add a tag.
4. Click in the Address field and select the (…).
6. The Data Type is automatically filled in when the tag is selected.
7. Type “Motor_On_Time_ms” in the Tag Name field.