Applies To:
  • CitectSCADA x.x

Summary:
Some of the CiCode functions documented in CiCode function help cannot be executed from the kernel CiCode window. For example, calling the DevFirst CiCode function from the kernel - CiCode window generates an "Unknown function" error message. 

Solution:
CiCode functions are divided into a number of types. Not all of which can be executed from the kernel - CiCode window:
  1. User CiCode functions written in C as part of the Citect run time executable. Func0.dbf (c:\citect\bin directory) file has a list of these CiCode functions for the compiler to compile these CiCode functions into the runtime executable. These CiCode functions can be called in the kernel CiCode window.
  2. User CiCode functions written in CiCode. These CiCode functions are in .ci files in the include project. These CiCode functions are compiled with the project and can be called in the kernel CiCode window.
  3. Macros in labels.dbf (c:\citect\user\system directory). These CiCode functions cannot be called in the kernel CiCode window, however, you can use the Label expression instead. For example ErrGetHw(type) will not execute in the Kernel but from it's Label in the Include project you can find the expression _ErrGetHw(type). The later will run in the Kernel.
  4. CiCode functions written by users. These CiCode functions are compiled with the project and can be called in the kernel CiCode window.

All compiled CiCode functions can be called in the kernel CiCode window.

As an example, DevFirst is defined as a macro in the labels.dbf file:

NAME            EXPR             COMMENT
DevFirst(hDev) DevSeek(hDev,0) DevSeek with Offset=0

Macro's cannot be executed from the kernel - CiCode window. See 'kernel: CiCode command' in the help index for more information. The second 'note' section explains macro's.

If execution of a CiCode function from the kernel - CiCode window fails and displays the "Unknown function" error, look for a macro definition of the CiCode function in labels.dbf and try executing the CiCode function referenced in the macro. For example DevSeek(hDev,0), in the case of DevFirst().

Notes:
References to directories in this article are made on the assumption that Citect is installed in the default installation directory (C:\CITECT). If Citect is installed in a different directory, then change the references appropriately.

 

Keywords:
 

Attachments