kernelv_sync_write_request()

Prototype

signed long int

kernelv_sync_write_request (unsigned short port,
                                       unsigned long int indexGroup,
                                       unsigned long int indexOffset,
                                       unsigned long int length,
                                       void* data);

Description

Synchronous writing of variables. The variables are identified by Port, indexGroup and indexOffset.

At present, the following ports are supported:

Port number

CNC task

551

GEO task

552

SDA task

553

COM task

The meaning of indexGroup and indexOffset depends on the addressed port and can be found in the documentation.

An error code is returned if the function is called while the CNC kernel has not yet started.

A write operation may last several NC cycles irrespective of the index group and index offset used. In this case the function returns the value 1 (RET_BUSY).

If this is the case, the function must be called again every time kernelv_do_cycle() is called until either the return value returned is 0 (RET_FINISHED) or an error message is returned.

Parameter

Name

Type

Meaning

port

unsigned short

Port via which data is to be written.

indexGroup

unsigned long

Index group of data item to be written.

indexOffset

unsigned long

Index offset of data item to be written.

length

unsigned long*

Size of the memory in bytes for the value to be written.

data

void*

Pointer to memory for the value to be written

Return values

Symbol

Value

Meaning

RET_FINISHED

0

The function was executed without error.

RET_BUSY

1

The function is currently being executed, but has not yet been completed.

The API function must continue to be called.

 

6

The transferred port number is not known.

 

0x701

The requested service is not supported.

 

0x702

Index group is invalid

 

0x703

Index offset is invalid

 

0x704

The variable addressed must not be written.

 

0x705

The data to be written does not match the addressed variable.

 

0x706

The job cannot be executed.

Possible reasons are:

  • invalid data on write accesses or
  • invalid state of kernelv, e.g. list updating while CNC channel is in error.