kernelv_ch_get_decoder_positions()
Prototype
KERNELV_RETURN | ChGetDecoderPositions(uint chanIndex, out KERNELV_DECODER_POSITION_HEADER header, out KERNELV_DECODER_POSITION_DATA[] data); |
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 |
chanIndex | uint | Channel index. |
header | out KERNELV_DECODER_POSITION_HEADER | After call, contains the general decoder data, including axis_count. |
data | out KERNELV_DECODER_POSITION_DATA[] | Contains the position data of all active axes in the channel. The number corresponds to header.axis_count. |
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. |