Applies To:
  • CitectSCADA 1.00 1.01 1.10 1.11 1.20 2.00 2.01 3.00 3.20 4.00

If too many Cicode tasks are running simultaneously, Citect will run out of task threads and will fail to execute new Cicode commands. If you press any button it will go down and up but the command will not execute, any keyboard commands will also not execute. You will not be able to change pages or do any operation in Citect. When this occurs you will get the hardware error "Out of Cicode threads". However as you cannot display the hardware alarm page you will not be able to view this error message. If you try to execute code from the Cicode Window of the Kernel, you will get the error "Unknown Function". 

This problem can be caused by either a configuration problem or running too may reports and background cicode threads.

The most likely cause of this problem is a configuration error which accidentally causes many cicode threads to be created. You can find the cicode task which is causing the problem by displaying the page in the Citect kernel 'PAGE TABLE CICODE", This page shows all the running cicode threads and the names of the functions they are calling. From the function names you should be able to find which of your functions is causing the problem. Typical causes of this problem are calling TaskNew() from Page Advanced animation. This will create a new task each time the page is refreshed (eg once per second). So after a 60 seconds of displaying this page you will run out of threads. You can also cause this problem if you created a thread when the page is first displayed using Mode =0 (when you should have used mode=1). This will cause one thread to be created when you goto page, so after you have displayed this page, then another page, the back to this page again 60 times you will get the error (this could take a long time to happen). Other causes are if you have background cicode creating a thread from some event. This cicode will keep creating threads until Citect runs out of threads.

It is unlikely you will run out of cicode threads by running too many reports/cicode tasks as the default number of threads is set to 64 (via parameter [CODE]threads) and a normal Citect project will use around 1-10 threads. If you have a very large number of reports running at the same time as well as a large number of background cicode threads this may occur. If this is the case then increase the default number of cicode threads by adjusting the [CODE]threads parameter.

In version 3.2 (4.1) and later when this error occurs Citect will now display a pop up message with the text "Out of Cicode threads" to tell you about this failure. Citect will also kill a cicode thread so you can continue to run Citect.