IEC 61131 Logic Programming in Cscape 10

The popularity of IEC 61131 continues to grow – and Horner’s Cscape All-in-one Software suite offers one of the best IEC editors out there. In this webinar, we’ll highlight its capabilities and its advantages. If you are an IEC user or are thinking about becoming one – you need to check it out!




0:17

Hello and welcome to today’s webinar. Today we will look at IEC 61131 logic programming in Cscape 10.

0:27

Let’s look at our agenda for today. We will look at some of the advantages of Cscape’s IEC editor.

0:34

We will discuss the ability to drag and drop variables, freeform logic editing, expansive string handling, the availability of structured text, and program variable and structured text debugging.

0:49

We will then demonstrate these features in Cscape 10, and we will finish with a Q &A session.

0:55

Similar to most PLC programming packages, generic IEC has drag and drop capabilities for variables.

1:03

You can also double-click on the function, contact, coil or operand, and have a smart list appear to choose your variable instead.

1:11

This is a useful function when using the same variables repeatedly, and you need to drag them on top of operands or contacts.

1:19

You can also choose how you want to sort the smart list, such as alphabetically.

1:24

With Cscape 10’s IEC editor, you can easily cycle through contact types or coils by highlighting a contact with your mouse and pressing the spacebar.

1:34

Instead of selecting a function block from the project toolbox, you can also choose to place an empty block into your ladder and double click on it to configure it.

1:44

This method allows you more space on your screen.

1:47

With Cscape 10’s IEC editor, you are not required to place an opening contact when creating your function blocks.

1:54

You are also able to adjust the cell width and height infinitely with advanced ladder by dragging the sides of the cell instead of just normal view mode and wide mode with standard ladder.

2:05

Cscape 10 IEC allows you to add multiple operands to a single add instruction.

2:11

This has been a limitation of standard ladder and other previous packages where when you needed to totalize several items you had to add each item individually.

2:21

With IEC you can add up to 255 In terms of ladder editing, it is now much easier to add a series of parallel contacts, as you can simply click the Contact Parallel button to the left of the logic window.

2:36

Cscape IEC also offers extensive string handling functions and instructions, as seen in the list here.

2:44

Next, we will look at some of the debug capabilities available with Horner’s IEC editor in Cscape that you may not find with some competing IEC editors.

2:53

In standard advanced ladder, you usually need to create watch windows to monitor your logic.

2:59

With Horner’s IEC editor, the variable list goes live once you go into debug mode, allowing you to see the status of all your variables in the variable list.

3:09

Once again, you can sort this list in many ways, such as by the variable name, the memory address, or the data type.

3:16

With the IEC editor, you can also monitor and view the status of any variables in your structured text logic in debug mode.

3:25

IEC also supports a lot of structured text availability.

3:29

For example, single line or multi-line comments can be added anywhere, such as above your code, as well as to the left or right of your code.

3:38

Value assignments in structured text are now much easier with Cscape IEC.

3:42

For example, when you’re starting up your program and you need to initialize a lot of variables, or when you’re switching from auto to manual mode and you need to turn a lot of things off or reset them to zero, or when you’re switching from auto to manual mode and you need to turn a lot of things off or reset them to zero, you do not need to write structured text where each assignment is on its own line.

4:05

Instead, you can assign multiple values to variables in one line of text, using a semicolon as the delimiter.

4:12

In addition to this, you can now hardcode recipes and do your editing in Word or Excel instead of Cscape if you choose.

4:21

Horner’s IEC editor also supports additional unique structured text capabilities, such as if statements, which can be used in conjunction with the looping statement as shown.

4:32

Next, we will look at the three structured text looping functions, starting with for loops.

4:37

One benefit of the FOR function is that you can set how long you want to be in the loop for, helping to prevent your program getting stuck in an infinite loop.

4:47

We also have the WHILE function, which we will note does not have this feature, so it is important to create a WHILE condition in order to get out of the loop and prevent infinite looping.

4:58

The third looping function in structured text is the REPEAT function.

5:02

This function will repeat its instructions until something is true.

5:06

Similar to the while function, the repeat function should also be coded with a condition to avoid infinite looping.

5:13

Finally, we have the case statement. This is very useful if you are using state logic.

5:19

So if you are looking at one variable and the value within that variable defines the state that you’re in, the case statement can be used to go through the list until it finds the true condition for that variable.

5:30

The case statement can be used to go through the list until it finds the true condition for that variable.

5:37

This statement can be useful if you have a lot of conditions in your logic, and in terms of scan time, this is one of the most efficient ways to do a lot of comparisons against the same variable.

5:49

Now we will demonstrate these features in Cscape’s IEC ladder editor.

5:54

First, we will look at the drag and drop functionality.

5:57

To do this, we will navigate to the program variable window and highlight the start push button contact, then drag and drop it onto our logic window.

6:07

This is automatically created a new rung with a normally open contact.

6:12

We will repeat this with our motor rung contact and place it next to the start push button.

6:18

We will also add a stop push button between these two contacts in the same way.

6:22

As we mentioned earlier, with Cscape 10 we can easily cycle through the different contact types by simply pressing the space bar on our keyboard.

6:32

When we select our stop push button and press the space bar, the contact changes to a normally closed contact.

6:39

We can keep cycling through these contact types by pressing the space bar.

6:44

We can also easily add a parallel contact or multiple parallel contacts with the same drag and drop method.

6:51

We will also note that you can adjust the length and width of the rungs on your ladder with the adjustments on the sides of the logic window.

7:00

Next, we will add a function block and create a new rung on our ladder with the Add Function Block button, without needing to add an always-on contact.

7:09

By default, this function block is a multiply block.

7:13

When we double-click this, we can access the block’s Configuration dialog box.

7:18

If we just want to add numbers together, we will select the Math category, then select Add, and then set the number of variables we want to add together.

7:29

We will choose to add 4 variables together instead of just the standard 2.

7:34

From here we can add any variables we wish.

7:37

We can choose to add our 4 variables manually, or we can use our Pull Down Total Parts option.

7:45

That concludes our webinar for today.

7:48Thank you so m