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 2.2.24. 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 2.2.25 |
25 | KERNELV_DECODER_POSITION_DATA | Axis positions and axis number of the 2nd axis. For structure definition, see 2.2.25 |
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 | Index of the channel |
ret_buffer | void* | Pointer to the memory area to which the return data is to be written. |
buffer_size | unsigned long | Size of the provided memory area in bytes. |
ret_Length | unsigned long* | 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. |