kernelv_ch_set_variable_value()

Prototype

KERNELV_RETURN

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

Description

Writes variables defined for a CNC kernel.

Writing a variable is only possible if it is writeable by the NC program. External variables can always be written irrespective of the access type configured.

Currently, the following variable types can be written.

Type

Example

External variables

V.E.VAR_1

Global variables, see (1)

V.G.WZ_AKT.R

Axis-specific variables

V.A.WCS.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 written 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 variable value to be written must be transferred in the KERNELV_VARIABLE *var structure.

An error code is returned if an error occurred while writing 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_DATA_TYPE_MISMATCH

-14

On write access to a variable, the transferred data type does not match the data type used internally in the CNC.

ERR_VAR_NAME_LENGTH

-18

The variable name passed on 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 or written ‘en block’ by omitting the array index at access. The kernelv DLL does not currently support this access type.

ERR_VAR_NOT_WRITEABLE

-22

An attempt was made to write a non-writeable variant. For write access to variables, the same access rules apply as within an NC program. The only exception here are V.E. variables. They can always be written irrespective of the access rights configured.