How to... create and call a function in B&R Automation Studio

preview_player
Показать описание
This HowTo video shows how to create and call a function.
A simple multiplication function will be made in this video.
It is important to choose the correct return type for the function that is made, in this case it will be a real.
The function will then be called inside a program, declaring the correct type of input variables to it.

Automation Studio is the integrated software development environment from B&R that contains tools for all phases of a project. The controller, drive, communication, and visualization can all be configured in one environment.

In a series of short tutorials, MA-IT MyAutomation would like to help you get familiar with Automation Studio.

----- Transcription ---------------------------------------------------
This video will explain how to create and call a function.
Add a function from the toolbox to the library.
Choose the option Function and give it a suitable name.
For this example the function will be written in structured text.
Make sure to choose the correct return type for the function.
For this example the return type will be a real.
This simple function will multiply 2 numbers, so 2 input variables are added.
Both variables are a real, because a number will be entered.
The outcome of the multiplication is written to the return type, which is the function itself.
The input variables are used for the multiplication.
Now lets call the function in a program.
Click on the FB icon in the top left.
Go to the library and choose the correct function.
The function tells us which variable types are needed.
In this example two variables are entered.
Instead of using variables, a number can be entered too.
Both variables are declared as a real type.
The function itself also needs to be written to a real variable.
In this example the variable calculation is used.
Next, transfer the project to test the function.
Monitor the program and add the variables to the watch table.
The function will multiply the two entered values.
The calculation variable is used because the function itself cannot be monitored.
Рекомендации по теме