kernelv_ch_get_variable_value()

Prototype

KERNELV_RETURN

kernelv_ch_get_variable_value (unsigned long int chanIndex,
                                                    char* varName,
                                                    KERNELV_VARIABLE *var);

Description

Reads a variable out of the CNC kernel. Currently, the following variable types can be read.

Type

Example

External variables

V.E.VAR_1

Global variables, see (1)

V.G.CNC_RELEASE

Axis-specific variables

V.A.+SWE.X

Program global, self-defined variables

V.P.VAR_1

Cross-program, self-defined variables

V.S.VAR_1

Program non-global, self-defined variables

V.L.VAR_1

Currently, it is not possible to read Type V.G.WZ[]. variables.

The variable to be read is identified on the basis of its name and the channel index.

The complete name (including the V.E. prefix and the array index in the case of array variables) must be specified as the name.

Example: "V.E.VAR_FLOAT_ARRAY[3]"

The value is returned in the KERNELV_VARIABLE *var structure.

An error code is returned if an error occurred while reading the variables.

Parameter

Name

Type

Meaning

chanIndex

unsigned long

Channel index of the channel from which the variable is to be read.

varName

char*

Pointer to the variable name.

var

KERNELV_VARIABLE*

Pointer to structure to which the variable value and the type are to be written.

Return values

Symbol

Value

Meaning

RET_FINISHED

0

The function was executed without error.

ERR_INVALID_CHAN

-1

The transferred channel index is higher than the number of configured channels - 1

ERR_CNC_NOT_INIT

-3

The simulation CNC kernel was not yet initialised.

ERR_CNC_RET_MEMORY

-4

The return value(s) does/do not fit into the memory provided.

ERR_INTERNAL_ERROR

-11

An internal error has occurred in the DLL.

ERR_UNKNOWN_VARIABLE

-12

The variable name is not known in the CNC kernel.

ERR_VARIABLE_SYNTAX

-13

The variable name is syntactically incorrect, e.g. no closing bracket in the case of an array variable.

ERR_VAR_NAME_LENGTH

-18

The variable name transferred to the function exceeds the maximum permissible length (KERNELV_VAR_NAME_LENGTH).

ERR_ARRAY_NOT_SUPPORTED

-21

With many CNC real-time variants, an array can be read ‘en block’ by omitting the array index on access. The kernelv DLL does not currently support this access type.