What is Global C script in wincc programming and how to use Global C script

Published on May 29, 2025 | Category: wincc
Share this article:

in c programming a function is a block of reusable code that performs a specific task. Instead of writing the same code multiple times, you define it once as a function and call it wherever needed. in wincc scada you can create these global function to use multiple time. in this article we learn how to create and use global scripts in C for Siemens WinCC SCADA systems. This guide covers the structure, syntax, and examples of using C functions in global scripting to build efficient automation logic.

Why Use Functions?

Functions allow you to write a block of logic once and reuse it multiple times throughout your program.following are benifits to use a function in wincc scada c programming

img/c script function/what is function in global script and syntax of function.webp

what is function in global script and syntax of function

function is a self-contained block of code that performs a specific task. It is typically designed to take some input (called parameters), process it, and then return a result. If no result needs to be returned, a function can be declared with a void return type.

basic syntax of function in wincc scada c programming

return_type function_name(parameter_list) {
    // function body
    return value; // if needed
}

how to create a function in wincc scada global c script

a global script editor are used to make a global function in wincc scada c programming. to open global c script editor in your wincc explorer select global script and than select c script and double click.

img/c script function/how to create a function in wincc scada global c script.webp

create a global function in wincc scada c script

a global script editor is open. now we make a simple global project function and use this function in our screen object and component. select project function and than add new function

img/c script function/create a global function in wincc scada c script.webp

create a global function in wincc scada c programming

now automatic function are added. you can remove or change this function to make your own. a basic syntax of a function alredy discussed above. now create a following function and than compile.

img/c script function/create a global function in wincc scada c programming.webp

how to use a global function in wincc scada

now open graphics designer and add three input output field and a button. in input output field set tag input1, input2, and input3. select button and add a c action on a mouse click event. add a another input output field to show result of addition, and tag output.

img/c script function/add c script in c action editor.webp

add c script in c action editor

c action editor open here simple double click on project function and selct your function. in out function name is addvalue. double click on it and than add tag or constant value in function assigning parameter popup window.

img/c script function/how to use a global function in wincc scada.webp

When a user clicks on a specific object in the WinCC interface, this function reads three input tag values, sums them using a custom function, and writes the result back to an output tag—automating data processing within the SCADA system.

wincc scada c code explanation

img/c script function/wincc scada c code explanation.webp

Kennethanili
June 17, 2025, 3:30 pm

https://www.goodreads.com/user/show/191174935-perez-kaden

ThomasTig
June 8, 2025, 6:22 pm

https://www.prolink-directory.com/Rent-a-car-in-Protugal_342336.html