kernelv_ch_get_decoder_positions()

Prototype

[ret, dec_positions, buffer_length]

ch_get_decoder_positions(vnck: ctypes.CDLL,

chan_index: int);

Description

This function requests the decoder for the currently active axis positions in the machine coordinates and in the programming coordinates.

The values returned by the function are written to header and data. If the returned data does not fit in the memory area provided, the error code ERR_CNC_RET_MEMORY is returned.

The returned data has the following structure. The individual data elements of the structures are packed in the memory:

Byte index

Type

Meaning

0

KERNELV_DECODER_POSITION_HEADER

For general data about the decoder positions supplied, see subsection Struct KERNELV_DECODER_POSITION_HEADER. Enter the number of the following structures of type KERNELV_DECODER_POSITION_DATA in the axis_count element.

11

KERNELV_DECODER_POSITION_DATA

Axis positions and axis number of the 1st axis. For structure definition, see subsection Struct KERNELV_DECODER_POSITION_DATA

25

KERNELV_DECODER_POSITION_DATA

Axis positions and axis number of the 2nd axis. For structure definition, see subsection Struct KERNELV_DECODER_POSITION_DATA

39

…

...

Since the maximum possible number of axes in the channel is currently limited to 32, the maximum size of the return value is 459 bytes.

Parameter

Name

Type

Meaning

vnck

ctypes.CDLL

Instance of the loaded KernelV DLL.

chan_index

int (unigned)

Channel index

Return values

Name

Type

Meaning

ret

KERNELV_RETURN (int)

Return value of the native integrated C function.

dec_positions

Array[c_ubyte]

Decoder positions in the form of an array

buffer_length

int (unsigned)

Length of the return value.

KERNELV_RETURN

Symbol

Value

Meaning

RET_FINISHED

0

The function was executed without error.

ERR_CNC_NOT_INIT

-3

The simulation CNC kernel was not yet initialised.

ERR_INVALID_CHAN

-1

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

ERR_CNC_RET_MEMORY

-4

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