Applies To:
  • CitectSCADA 1.00, 1.01, 1.10, 1.11, 2.00, 2.01

Summary:
If your Cicode stops running (without completing) for some unknown reason, check if you are calling a blocking type function. Blocking functions can only be called in Cicode that has time to wait for whatever event the blocking function is waiting for. Cicode called from events eg Alarm On/Off action, callback events, page numbers, page text, page symbols, page colours, page bar graphs, page trends, page string, page advanced or page background is considered critical and cannot call blocking functions. If you try to call a blocking Cicode function, (eg Sleep(), see online help for details) your Cicode will be terminated, and the hardware error 'Foreground Cicode cannot block' will be generated. 

Solution:
You may get around this effect by calling your Cicode from a fresh task - by starting it with TaskNew(). Cicode called from TaskNew can call any blocking function as it is not considered critical. Note that your code must check for the case where it is started more than once, ie reentered. For example if your Cicode did something as follows and was called with the alarm on event:

PageDisplay("AlarmPage");
Sleep(10);
PageLast();

Think what would happen if two alarms where activated in less than 10 seconds! This problem is one of the reasons you cannot call blocking functions from these places, ie an event is an atomic operation and must finish before Citect can do any other operation. 


Keywords:
 

Attachments