# Coding mistake in ST in SafeDESIGNER

**URL:** <https://community.br-automation.com/t/coding-mistake-in-st-in-safedesigner/10930>\
**Category:** Programming\
**Tags:** mapp-safety\
**Created:** [April 17, 2026, 5:25am UTC](https://community.br-automation.com/t/coding-mistake-in-st-in-safedesigner/10930 "2026-04-17T05:25:11Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![scme](https://avatars.discourse-cdn.com/v4/letter/s/FF8800/32.png) [@scme](https://community.br-automation.com/u/scme)\
**Post date:** [April 17, 2026, 5:25am UTC](https://community.br-automation.com/t/coding-mistake-in-st-in-safedesigner/10930/1 "2026-04-17T05:25:11Z")

</div>

Good morning,

I’m trying to program a small ST Code snippet in SafeDESIGNER, which increases a time value by 10s for every bit set in a word.

I already found that I need three time variables as I cannot write TempTime := TempTime + TIME#10s.

The remaining compiler error is not really helpful, as it tells me something about expected an empty datatype and contacting the technical support.

Maybe somebody can help me with this?

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/1/1601266978c041ff81c62cbad6f0b3073a69d4fb.png)

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/2/250733b06e99d0da911befdc73c76ec1bbce5c9f.png)

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/6/60df68282a7c377597ae478a86ca62386cd68fad.png)

---

<div class="post-metadata">

**Author:** ![seunghwa](https://avatars.discourse-cdn.com/v4/letter/s/FF8800/32.png) [@seunghwa](https://community.br-automation.com/u/seunghwa)\
**Post date:** [April 17, 2026, 5:53am UTC](https://community.br-automation.com/t/coding-mistake-in-st-in-safedesigner/10930/2 "2026-04-17T05:53:06Z")

</div>

Can you try T#10s instead of TIME#10s?  
In IEC61131-3 datatype are using T#xxx. ([Wikipedia - IEC61131-3](https://en.wikipedia.org/wiki/IEC_61131-3#Elementary_Data_Types_(Character_/_Character_string)))

You can find datatype and how to use time and date.  
[AS help - Datatype](https://help.br-automation.com/#/en/6/programming/datatypes/programmingmodel_datatypes_simple.html)

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/7/7be0b66e40c3e931215838de73277c2fe5b5ed12.png)

---

<div class="post-metadata">

**Author:** ![scme](https://avatars.discourse-cdn.com/v4/letter/s/FF8800/32.png) [@scme](https://community.br-automation.com/u/scme)\
**Post date:** [April 17, 2026, 5:56am UTC](https://community.br-automation.com/t/coding-mistake-in-st-in-safedesigner/10930/3 "2026-04-17T05:56:55Z")

</div>

Thanks for your reply. Same error, when trying this.

In the docs for SafeDESIGNER the initialization is listed as following, so my syntax should be correct, I guess.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/e/e37acd028395829cd4ec57eff6d0264f73ad83d4.png)

---

<div class="post-metadata">

**Author:** ![valerio.manenti](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/valerio.manenti/32/11712_2.png) [@valerio.manenti](https://community.br-automation.com/u/valerio.manenti)\
**Post date:** [April 17, 2026, 11:56am UTC](https://community.br-automation.com/t/coding-mistake-in-st-in-safedesigner/10930/4 "2026-04-17T11:56:27Z")

</div>

Hi @scme ,  
Have you tried T# instead of TIME#?

From the [manual](https://www.br-automation.com/en/downloads/safety-technology/integrated-safety-technology-users-manual-mapp-safety/):

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/d/d05223289284bd388bf2fd2ff48bb9ab1c215b5c.png)

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/1/19448d4cdfc3ba86871eef51e991fca28ff31a8e.png)

# ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/8/854b1df7d9a96eb72552332e22074a1556c35388.png)

but…long prefix should be ok too…

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/d/d9a647d61a2cec7ef7ae198edf7140328b480f01.png)

SOS @michael.bertsch…  
Ciao  
Valerio

---

<div class="post-metadata">

**Author:** ![michael.bertsch](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/michael.bertsch/32/239_2.png) [@michael.bertsch](https://community.br-automation.com/u/michael.bertsch)\
**Post date:** [April 17, 2026, 2:32pm UTC](https://community.br-automation.com/t/coding-mistake-in-st-in-safedesigner/10930/5 "2026-04-17T14:32:35Z")

</div>

Hello,

Sorry Valerio i do not yet have the final answer but i can tell you something…

I have opened MappSafety and created a Functionblock in ST with the Declaration given.  
I have slightly modified the Name of TempTime2 to have in mind that i need it for the Feedback.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/5/521cf9cea4682d39af5949e4f52f6016efe666d1.png)

This one is compiling without issues.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/6/65d7714038c5dacc100f092dbe28d9edfcc99c6a.png)

These two are the same

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/d/d79d11aa77a0452a7caaa4127233ae0d9239f04e.png)  
 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/6/6df0fea1d74306966880db762525e8f2ba6beb60.png)  
 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/8/8bd83f99ea77c5e583477e24502e6468e73f3aa1.png)

If i add the Addition function from the Toolbox i get this. It looks like the Addition only likes a ANY\_NUM.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/8/895f1aa3975eb2a2b3643199696d0a4906a945ae.png)

Testing only this… error  
 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/5/53cb7a2e8e964dc9448b9919087657dd5cd5d6da.png)  
 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/7/7d52641a248046b9579fb5017edfe57e2ab1f147.png)

Changing to DINT it compiles again

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/d/d3c34a2cd86dda3884fbade56545e25506bf5c45.png)  
 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/6/65c7050d400524169c9f11fe7eea8ced3c229ea0.png)

**It looks like you need to solve the question if it is possible and how to ADD two TIME’s in SafeDesigner. The default Addition looks only to be declared for Numerical Values.**

You could now think of doing this with a Numerical Value and then convert to TIME.  
But i did not found a conversion from Numerical to Time eighter.

We may have to discuss the initial intend of the SafeApplication and if there is an alternative aproach to the use case.

Now its time for a weekend…

Greetings  
Michael

---

<div class="post-metadata">

**Author:** ![michael.bertsch](https://dub1.discourse-cdn.com/brcommunity/user_avatar/community.br-automation.com/michael.bertsch/32/239_2.png) [@michael.bertsch](https://community.br-automation.com/u/michael.bertsch)\
**Post date:** [April 17, 2026, 3:11pm UTC](https://community.br-automation.com/t/coding-mistake-in-st-in-safedesigner/10930/6 "2026-04-17T15:11:15Z")

</div>

Hello,

ok, i was a bit challanged and had a idea but then… There was another issue with a Datatype Conflict between the Loop-Index in INT and the BIT\_TST requiring a BYTE.

It looks nasty but i think this could be a working solution which does the operation of the initaly posted code.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/6/681b5ce28e8711a6cb61446976690e7a55ce9548.png)

```auto
Temp := INT#0; 
TempFeedback := INT#0; 

IF BIT_TEST(ValveOffConfig, BYTE#0) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp; 

IF BIT_TEST(ValveOffConfig, BYTE#1) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp; 

IF BIT_TEST(ValveOffConfig, BYTE#2) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp; 

IF BIT_TEST(ValveOffConfig, BYTE#3) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp; 

IF BIT_TEST(ValveOffConfig, BYTE#4) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp; 

IF BIT_TEST(ValveOffConfig, BYTE#5) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp; 

IF BIT_TEST(ValveOffConfig, BYTE#6) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp; 

IF BIT_TEST(ValveOffConfig, BYTE#7) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp; 

IF BIT_TEST(ValveOffConfig, BYTE#8) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp; 

IF BIT_TEST(ValveOffConfig, BYTE#9) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp; 

IF BIT_TEST(ValveOffConfig, BYTE#10) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp; 

IF BIT_TEST(ValveOffConfig, BYTE#11) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp;

IF BIT_TEST(ValveOffConfig, BYTE#12) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp;

IF BIT_TEST(ValveOffConfig, BYTE#13) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp;

IF BIT_TEST(ValveOffConfig, BYTE#14) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp;

IF BIT_TEST(ValveOffConfig, BYTE#15) THEN 
    Temp := TempFeedback + INT#1;
END_IF;  
TempFeedback := Temp;

CASE Temp OF 
    0: SurvTimeCalc := TIME#0s;  
    1: SurvTimeCalc := TIME#10s;
    2: SurvTimeCalc := TIME#20s;
    3: SurvTimeCalc := TIME#30s;
    4: SurvTimeCalc := TIME#40s;
    5: SurvTimeCalc := TIME#50s;
    6: SurvTimeCalc := TIME#60s;   
    7: SurvTimeCalc := TIME#70s;
    8: SurvTimeCalc := TIME#80s;
    9: SurvTimeCalc := TIME#90s;
    10: SurvTimeCalc := TIME#100s;
    11: SurvTimeCalc := TIME#110s;
    12: SurvTimeCalc := TIME#120s;
    13: SurvTimeCalc := TIME#130s;
    14: SurvTimeCalc := TIME#140s;
    15: SurvTimeCalc := TIME#150s;              
    ELSE SurvTimeCalc := TIME#0s;
END_CASE; 

```

I only did some quick tests in Simulation.

 ![image](https://europe1.discourse-cdn.com/brcommunity/original/2X/7/73e86a698292502e0b14bd706df0d68496a50ba1.png)

**This is not a recommendation to use this code. Please make your own Validation.**

Greetings  
Michael

---

<div class="post-metadata">

**Author:** ![scme](https://avatars.discourse-cdn.com/v4/letter/s/FF8800/32.png) [@scme](https://community.br-automation.com/u/scme)\
**Post date:** [April 20, 2026, 5:31am UTC](https://community.br-automation.com/t/coding-mistake-in-st-in-safedesigner/10930/7 "2026-04-20T05:31:27Z")

</div>

Thanks Michael, I guess this should work. I wanted to avoid writing this long code instead of using FOR, but if there is no other way, it will serve for what I need.
