Posted 18 Jan 2019 Hello, I am new to SCL programming in TIA Portal. I have some experience in TwinCat3, but i have difficulties getting som simpelt code to work in TIA. This code works fine in TwinCat, but i does not work in TIA. "Timer".TOF(IN:=NOT "Timer".Q, PT:=T#2s); "TimerOneShot"(CLK := "Timer".Q); IF "TimerOneShot".Q THEN "Test" := "Test" + 1; END_IF; Can anyone help me in the right track.... ?? Share this post Link to post Share on other sites
Posted 19 Jan 2019 (edited) Hi jthyge. Firstly, welcome to the forum. If you have entered this as an SCL Source, the compiler will tell you where the errors are when you go to compile. Dont forget that- you need to declare what type of block you are creating (UDT, FB, FC, DB) with the necessary Symbolic Name. This decleration needs to be at the beginning of your source code. Regards Daniel Edited 19 Jan 2019 by collinsd70 Share this post Link to post Share on other sites
Posted 19 Jan 2019 Hi collinds70 Thanks for your reply. Maybe i did not explain the problem correct. The code is working fine, but the function is not working. Maybe the Timer or R_Trig works differently in TIA than TwinCat? When I test the timer it works, when I test the oneshot i works fine. But they do not work i combination. I want the "Test" to increase by 1, every 2 second. It is a bit frustrating that I can not get simple things like this to work i TIA, when it is no problem i TwinCat... Share this post Link to post Share on other sites
Posted 22 Jan 2019 (edited) OK Apparently the timers in TwinCat and Siemens work different. In Siemens the timers run in a DB. So if the timer resets itself, the FB code will not catch the output on a scan. So if I use the TimerOneShot.Q to reset til timer i will work fine. Best regards Jesper Edited 22 Jan 2019 by jthyge Share this post Link to post Share on other sites