Posted 24 Dec 2011 FUNCTION SetDigitalAlarm() REAL value = TagRead("Ramp_Float"); IF value > 20.00 AND value < 30.00 THEN TagWrite("Tag_alarm_1", 1); ELSE IF value > 40.00 AND value < 80.00 THEN TagWrite("Tag_alarm_2", 1); ELSE TagWrite("Tag_alarm_3", 1); END END END Error 343 foreground cicode cannot break. please, help me!!! Share this post Link to post Share on other sites
Posted 24 Dec 2011 I would assume you have called the SetDigitalAlarm() from the graphics page. If this is the case then while the page is displayed it is constantly calling this function. Try adding a sleep() time to the function, or create a new function that calls this funtion with tasknew() Share this post Link to post Share on other sites
Posted 24 Dec 2011 no no no no Cicode Foreground tasks are for immediate display not alarming - there is NO time to wait for the code to complete what it appears you are doing is using a cicode display function to create alarms When you are on a different page this alarm will not trip - the code does not execute Tagread is a BLOCKing function - it cannot be used on a display function Two possible methods to make it work 1) IF the code is page specific then use the page_entry property to call code with a while (1) DO loop example Cicode TagWrite 2) If the code is to run all the time then use the built in alarming - Analog alarm - Advanced alarm (one entry per Tag_alarm_x) 3) IF the Tag Ramp_Float is an operator entry then put that code into the Action Share this post Link to post Share on other sites