Learn CITECT-SCADA with Real Code Examples
Updated Nov 27, 2025
Code Sample Descriptions
1
Hello World Message in Citect SCADA
Message("Hello World from Citect SCADA!");
Show a simple message box in Citect SCADA using Cicode.
2
Increment an Integer Tag
INT val;
val = TagReadInt("Counter");
val = val + 1;
TagWrite("Counter", val);
Increase the value of an integer tag by 1.
3
Toggle a Boolean Tag
BOOL current;
current = TagReadBool("LightOn");
TagWrite("LightOn", NOT current);
Toggle a boolean tag, useful for lights or motor start/stop.
4
Display Tag Value in Graphic
REAL level;
level = TagReadReal("TankLevel");
SetLabelText("TankLevelLabel", NumToStr(level, 2));
Read a tag and display it in a numeric text object in a graphic.
6
Write Multiple Tags at Once
TagWrite("MotorStart", TRUE);
TagWrite("MotorSpeed", 50);
Set multiple tag values in a single script.
7
Slider Control for Speed Tag
REAL speed;
speed = GetSliderValue("SpeedSlider");
TagWrite("MotorSpeed", speed);
Bind a slider in a graphic to update a speed tag.
8
Log Button Click Event
STRING logEntry;
logEntry = DateTime() + " Button clicked";
WriteLog("ButtonLog", logEntry);
Log each time a button is pressed.
9
Read Multiple Tags into Array
REAL values[2];
values[0] = TagReadReal("TankLevel");
values[1] = TagReadReal("PumpStatus");
Read several tag values and store them in an array.
10
Conditional Action Based on Tag Value
REAL temp;
temp = TagReadReal("TankTemp");
IF temp > 80 THEN
TagWrite("CoolerOn", TRUE);
ELSE
TagWrite("CoolerOn", FALSE);
ENDIF;
Control another tag based on a condition.