kernelv_ch_get_decoder_positions()
Prototype
KERNELV_RETURN | kernelv_ch_get_decoder_positions(unsigned long int chanIndex, |
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 the memory area that points to the buffer. The size of this memory area must be specified in the buffer_size variable. The actual size of the returned data is returned in ret_length. If the returned data does not fit in the memory area provided, the error code ERR_CNC_RET_MEMORY is returned. In this case ret_length contains the memory size required for the return.
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 |
chanIndex | unsigned long int | Channel index. |
ret_buffer | void* | Pointer to the memory area to which the return data is to be written. |
buffer_size | unsigned long int | Size of the provided memory area in bytes. |
ret_Length | unsigned long int* | Pointer to the memory area to which the actually returned bytes are to be written. |
Return values
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. |