Cicode Programming Reference > Cicode Function Categories > Task Functions Introduction > CodeSetMode

CodeSetMode

Sets various execution modes for Cicode tasks in the current thread. Using this function, you can specify whether to:

Syntax

CodeSetMode(Type, Value)

Type:

Type of mode:

0 - Write to a local image of an I/O device. If you set Value to 1, this mode is enabled, and Cicode writes its local memory image of the I/O device whenever you write to the I/O device. (Cicode assumes that most writes to the I/O device will be done immediately).

This local image might produce problems, or you might want to verify that the data was actually written to the I/O device. If you set Value to 0 (zero), this check is disabled, and Cicode does not write to the local memory image.

1 - Check if a variable is within range before writing it to the I/O device. If you set Value to 1, this mode is enabled. When a variable tag is modified, Cicode checks the new value of the variable against the Scales specified in the Variable Tags database. If the value of the variable is out of scale, Cicode generates a hardware error, and does not write to the I/O device.

If you set Value to 0 (zero), this check is disabled. Cicode writes the variable to the I/O device without checking if its value is within range.

2 - Echo error messages to the operator. If you set Value to 1, this mode is enabled. When a simple user error occurs (for example, if the PageDisplay() function is passed a bad page name), Cicode displays an error message at the Error AN, and returns an error code from the function.

If you set Value to 0 (zero), the echo is disabled. Cicode does not display the error message, and the output of the DspError() function is stopped.

3 - Ignore the case of string data in the current thread of Cicode. If you set Value to 1, this mode is enabled, and CitectSCADA will ignore case in string data. For example, CitectSCADA will equate "Hello" to "HELLO".

If you set Value to 0 (zero), CitectSCADA will be case sensitive to string data. Case sensitivity is used when a string comparison operation is performed. For example:

IF sStr1 = sStr2 THEN

(You can also make CitectSCADA case sensitive to strings in all of your Cicode, using the [Code]IgnoreCase parameter.)

Value:

The value of the mode:

0 - Disable

1 - Enable

Return Value

-1 if there is an error, otherwise the last value of the mode.

Example

! disable local image write
CodeSetMode(0, 0);

See Also

Task Functions