General Handling

DapiOpenModule
This function opens a particular module.

DapiOpenModule

 

Description

This function opens a specific module

 

Definition

ULONG DapiOpenModule(ULONG moduleID, ULONG nr);

 

Parameters

moduleID=Specifies the module to be opened (see delib.h)
nr=Specifies which one (in case of several modules) should be opened.
nr=0 -> 1st module
nr=1 -> 2nd module

 

Return-Value

handle=Corresponding handle for the module
handle=0 -> module was not found

 

Comment

The handle returned by this function is needed to identify the module for all other functions.

 

Programming example

// Open USB module
handle = DapiOpenModule(RO_USB1, 0);
printf(“handle = %x\n”, handle);
if (handle==0)
{
// USB module was not found
printf(“Modul konnte nicht geöffnet werden\n”);
return;
}

DapiCloseModule
This command closes an opened module.

DapiCloseModule

 

Description

This command closes an open module.

 

Definition

ULONG DapiCloseModule(ULONG handle);

 

Parameters

handle=This is the handle of an open module

 

Return-Value

None

 

Programming example

// Close module
DapiCloseModule(handle);

DapiGetLastError
This function returns the last registered error. If an error has occurred, it must be deleted with DapiClearLastError(), otherwise any call of DapiGetLastError() will return the "old" error. If multiple modules are used, the use of DapiGetLastErrorByHandle() is recommended.

DapiGetLastError

 

Description

This function returns the last detected error. If an error occurred, it must be cleared with DapiClearLastError(), otherwise any call to DapiGetLastError() will return the “old” error.
If more than one module should be used, it is recommended to use DapiGetLastLastErrorByHandle().

 

Definition

ULONG DapiGetLastError(void);

 

Parameters

None

 

Return-Value

Error Code
0=no error. (see delib_error_codes.h)

 

Programming example

BOOL IsError()
{
unsigned char msg[500];
unsigned long error_code = DapiGetLastError();

if (error_code != DAPI_ERR_NONE)
{
DapiGetLastErrorText((unsigned char*) msg, sizeof(msg));
printf(“Error Code = 0x%x * Message = %s\n”, error_code, msg);

DapiClearLastError();

return TRUE;
}

return FALSE;
}

DapiGetLastErrorByHandle
This function returns the last registered error of a particular module (handle). If an error has occurred, it must be deleted with DapiClearLastErrorByHandle(), otherwise any call of DapiGetLastErrorByHandle() will return the "old" error.

DapiGetLastErrorByHandle

 

Description

This function returns the last detected error of a specific module (handle). If an error occurred, it must be cleared with DapiClearLastErrorByHandle(), otherwise any call to DapiGetLastErrorByHandle() will return the “old” error.

 

Definition

ULONG DapiGetLastErrorByHandle(ULONG handle);

 

Parameters

handle=This is the handle of an open module

 

Return-Value

Error Code
0=no error. (see delib_error_codes.h)

 

Programming example

BOOL IsError(ULONG handle)
{
unsigned long error_code = DapiGetLastErrorByHandle(handle);

if (error_code != DAPI_ERR_NONE)
{
printf(“Error detected on handle 0x%x – Error Code = 0x%x\n”, handle, error_code);

DapiClearLastErrorByHandle(handle);

return TRUE;
}

return FALSE;
}

DapiGetLastErrorText
This function reads the text of the last registered error. If an error has occurred, it must be cleared with DapiClearLastError(), otherwise every call of DapiGetLastErrorText() returns the "old" error. Definition

DapiGetLastErrorText

 

Description

This function reads the text of the last detected error. If an error occurred, it must be cleared with DapiClearLastError(), otherwise any call to DapiGetLastErrorText() will return the “old” error.

 

Definition

ULONG DapiGetLastErrorText(unsigned char * msg, unsigned long msg_length);

 

Parameters

msg = Buffer for the text to be received
msg_length = Length of the text buffer

 

Programming example

BOOL IsError()
{
unsigned char msg[500];
unsigned long error_code = DapiGetLastError();

if (error_code != DAPI_ERR_NONE)
{
DapiGetLastErrorText((unsigned char*) msg, sizeof(msg));
printf(“Error Code = 0x%x * Message = %s\n”, error_code, msg);

DapiClearLastError();

return TRUE;
}

return FALSE;
}

DapiClearLastError
This function deletes the last error registered with DapiGetLastError().

DapiClearLastError

Description

This function deletes the last error registered with DapiGetLastError().

 

Definition

void DapiGetLastError(void);

 

Parameters

None

 

Return value

None

 

Example program

BOOL IsError()
{
unsigned char msg[500];
unsigned long error_code = DapiGetLastError();

if (error_code != DAPI_ERR_NONE)
{
DapiGetLastErrorText((unsigned char*) msg, sizeof(msg));
printf(“Error Code = 0x%x * Message = %s\n”, error_code, msg);

DapiClearLastError();

return TRUE;
}

return FALSE;
}

DapiClearLastErrorByHandle
This function deletes the last error of a particular module (handle), which was registered with DapiGetLastErrorByHandle().

DapiClearLastErrorByHandle

 

Description

This function deletes the last error of a particular module (handle), which was registered with DapiGetLastErrorByHandle().

 

Definition

void DapiClearLastErrorByHandle(ULONG handle);

 

Parameters

handle=This is the handle of an opened module.

 

Return value

None

 

Example program

BOOL IsError(ULONG handle)
{
unsigned long error_code = DapiGetLastErrorByHandle(handle);

if (error_code != DAPI_ERR_NONE)
{
printf(“Error detected on handle 0x%x – Error Code = 0x%x\n”, handle, error_code);

DapiClearLastErrorByHandle(handle);

return TRUE;
}

return FALSE;
}

DapiGetDELIBVersion
This function returns the installed DELIB version.

DapiGetDELIBVersion

 

Description

This function returns the installed DELIB version.

 

Definition

ULONG DapiGetDELIBVersion(ULONG mode, ULONG par);

 

Parameters

mode=Mode with which the version is read (must always be 0).
par=This parameter is not defined (must always be 0).

 

Return-Value

version=Version number of the installed DELIB version [hex]

 

Programming example

version = DapiGetDELIBVersion(0, 0);
//With installed version 1.32 version = 132(hex)

DapiOpenModuleEx
This function opens a specific module with ethernet interface.The particularity of this command is,that parameters like IP-address, portnumber and the duration of the timeout can be specified. The opening of the module is independent of the DELIB Configuration Utility settings.

DapiOpenModuleEx

 

Description

This function specifically opens a module with an Ethernet interface. The parameters IP address, port number and the duration of the timeout can be determined.
The module is opened independently of the settings made in the DELIB Configuration Utility.

 

Definition

ULONG DapiOpenModuleEx(ULONG moduleID, ULONG nr, unsigned char* exbuffer, 0);

 

Parameters

moduleID = Specifies the module to be opened (see delib.h)
nr = Specifies which one (in case of several modules) is to be opened
nr = 0 -> 1st module
nr = 1 -> 2nd module
exbuffer = buffer for IP address, port number and duration of the timeout

 

Return-Value

handle = Corresponding handle for the module
handle = 0 -> module was not found

 

Comment

The handle returned by this function is required to identify the module for all other functions.
This command is supported by all modules with Ethernet interface.

 

Programming example

// Open ETH-Module with parameter

DAPI_OPENMODULEEX_STRUCT open_buffer;

strcpy((char*) open_buffer.address, “192.168.1.10”);
open_buffer.portno = 0;
open_buffer.timeout = 5000;

handle = DapiOpenModuleEx(RO_ETH, 0, (unsigned char*) &open_buffer, 0);
printf(“Module handle = %x\n”, handle);

Digital input functions

DapiDIGet1
This command reads a single digital input.

DapiDIGet1

 

Description

This command reads a single digital input.

 

Definition

ULONG DapiDIGet1(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the input to be read (0, 1, 2, 3, .. )

 

Return-Value

Status of the input (0/1)

 

Requirements

The following SW feature bits must be supported by the module:

DAPI_SW_FEATURE_BIT_CFG_DI

The following conditions for the transfer parameters must be met:

maxCh = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG, DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DI, 0, 0)
maxCh > ch

DapiDIGet8
This command reads 8 digital inputs simultaneously.

DapiDIGet8

 

Description

This command reads 8 digital inputs simultaneously.

 

Definition

ULONG DapiDIGet8(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the input from which the read is to start (0, 8, 16, 24, .. )

 

Return-Value

Status of the read inputs

 

Requirements

The following SW feature bits must be supported by the module:

DAPI_SW_FEATURE_BIT_CFG_DI

The following conditions for the transfer parameters must be met:

maxCh = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG, DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DI, 0, 0)
maxCh > ch ch must be 0, 8, 16, …

DapiDIGet16
This command reads 16 digital inputs simultaneously.

DapiDIGet16

 

Description

This command reads 16 digital inputs simultaneously.

 

Definition

ULONG DapiDIGet16(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the input from which the read is to start (0, 16, 32, …)

 

Return-Value

Zustand der gelesen Eingänge

 

Requirements

The following SW feature bits must be supported by the module:

DAPI_SW_FEATURE_BIT_CFG_DI

The following conditions for the transfer parameters must be met:

maxCh = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG, DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DI, 0, 0)
maxCh > ch ch must be 0, 16, 32, …

DapiDIGet32
This command reads 32 digital inputs simultaneously.

DapiDIGet32

 

Description

This command reads 32 digital inputs simultaneously.

 

Definition

ULONG DapiDIGet32(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the input from which the read is to start (0, 32, 64, ..)

 

Return-Value

Status of the read inputs

 

Requirements

The following SW feature bits must be supported by the module:

DAPI_SW_FEATURE_BIT_CFG_DI

The following conditions for the transfer parameters must be met:

maxCh = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG, DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DI, 0, 0)
maxCh > ch ch must be 0, 32, 64, …

 

Programming example

unsigned long data;
// —————————————————-
// Read a value from the inputs (input 1-31)
data = (unsigned long) DapiDIGet32(handle, 0);
// Chan start = 0
printf(“Input 0-31 : 0x%x\n”, data);
printf(“key for further\n”);
getch();
// —————————————————-
// Read a value from the inputs (input 32-64)
data = (unsigned long) DapiDIGet32(handle, 32);
// Chan Start = 32
printf(“Input 32-64 : 0x%x\n”, data);
printf(“key for further\n”);
getch();

DapiDIGet64
This command reads 64 digital inputs simultaneously.

DapiDIGet64

 

Description

This command reads 64 digital inputs simultaneously.

 

Definition

ULONGLONG DapiDIGet64(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the input from which the read is to start (0, 64, ..)

 

Return-Value

Status of the read inputs

 

Requirements

The following SW feature bits must be supported by the module:

DAPI_SW_FEATURE_BIT_CFG_DI

The following conditions for the transfer parameters must be met:

maxCh = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG, DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DI, 0, 0)
maxCh > ch ch must be 0 or 64

DapiDIGetFF32
This command reads the flip-flops from the inputs and resets them. (Input state change).

DapiDIGetFF32

 

Description

This command reads the flip-flops of the inputs and resets them.
(input state change)

 

Definition

ULONG DapiDIGetFF32(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the input from which the read is to start (0, 32, 64, ..)

 

Return-Value

Status of 32 input status changes

 

Requirements

The following SW feature bits must be supported by the module:

DAPI_SW_FEATURE_BIT_CFG_DI_FF

The following conditions for the transfer parameters must be met:

maxCh = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG, DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DI_FF, 0, 0)
maxCh > ch ch must be 0, 32, 64, …

Digital input counter

DapiDIGetCounter
This command reads the counter of a digital input.

DapiDIGetCounter

 

Description

This instruction reads the input counter of a digital input.

 

Definition

ULONG DapiDIGetCounter(ULONG handle, ULONG ch, ULONG mode);

 

Parameters

handle=This is the handle of an open module.
ch=Specifies the number of the input from which to read.
mode=0 (normal counting function)
mode=DAPI_CNT_MODE_READ_WITH_RESET (read counter and reset direct counter)
mode=DAPI_CNT_MODE_READ_LATCHED (read out the stored counter value)

 

Return-Value

Output of the counter value

 

Requirements

The following SW feature bits must be supported by the module:

DAPI_SW_FEATURE_BIT_CFG_DI_CNT

The following conditions for the transfer parameters must be met:

maxCh = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG, DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DI_COUNTER, 0, 0)
maxCh > ch

 

Programming example

value = DapiDIGetCounter(handle, 0 ,0); // counter of DI Chan 0 is read
value = DapiDIGetCounter(handle, 1 ,0); // counter of DI Chan 1 is read
value = DapiDIGetCounter(handle, 8 ,0); // counter of DI Chan 8 is read
value = DapiDIGetCounter(handle, 0 ,DAPI_CNT_MODE_READ_WITH_RESET); // counter of DI Chan 0 is read AND reset
value = DapiDIGetCounter(handle, 1, DAPI_CNT_MODE_READ_LATCHED); // Reading the stored counter value of DI Chan 1

DapiSpecialCommand - DapiSpecialCounterLatchAll
This command saves the counter values of all digital inputs simultaneously into a temporary storage (latch). So, after that, the counter of the latch can be read successively. Here, the speciality is, that it is possible to "freeze" simultaneously the counter and the frozen counter (latch) can be read one by one.

DapiSpecialCommand – DapiSpecialCounterLatchAll

 

Description

This instruction stores the counter readings of all input counters simultaneously in a buffer (latch).
Thus, all counter readings of the latch can be read out one after the other.
A special feature is that a simultaneous “freezing” of the counter readings is possible and the frozen readings (latch) can then be read out one after the other.

 

Definition

void DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_COUNTER, DAPI_SPECIAL_COUNTER_LATCH_ALL, 0, 0);

 

Parameters

 

Comment

This command is only supported by our O8-R8 time modules!

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_COUNTER, DAPI_SPECIAL_COUNTER_LATCH_ALL, 0, 0);

DapiSpecialCommand - DapiSpecialCounterLatchAllWithReset
This command saves the counters of all digital inputs simultaneously into a temporary storage (latch). In addition, the counters of the digital inputs will be reset.

DapiSpecialCommand – DapiSpecialCounterLatchAllWithReset

 

Description

This instruction stores the counter readings of all input counters simultaneously in a buffer (latch). Additionally, the counter readings of the input counters are reset afterwards.

 

Definition

void DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_COUNTER, DAPI_SPECIAL_COUNTER_LATCH_ALL_WITH_RESET, 0, 0);

 

Parameters

 

Comment

This command is only supported by our O8-R8 time modules!

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_COUNTER, DAPI_SPECIAL_COUNTER_LATCH_ALL_WITH_RESET, 0, 0);

Digital output functions

DapiDOSet1
This is the command to set a single output.

DapiDOSet1

 

Description

This command sets a single output.

 

Definition

void DapiDOSet1(ULONG handle, ULONG ch, ULONG data);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the output to be set (0 .. )
data= Specifies the data value to be written (0 / 1)

 

Return-Value

None

 

Requirements

The following SW feature bits must be supported by the module:

 

DAPI_SW_FEATURE_BIT_CFG_DO

The following conditions for the transfer parameters must be met:

maxCh = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_GET_MODULE_CONFIG, DAPI_SPECIAL_GET_MODULE_CONFIG_PAR_DO, 0, 0)
maxCh > ch

DapiDOSet8
This command sets 8 digital outputs simultaneously.

DapiDOSet8

 

Description

This command sets 8 digital outputs simultaneously.

 

Definition

void DapiDOSet8(ULONG handle, ULONG ch, ULONG data);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the output from which writing is to start (0, 8, 16, 24, 32, ..)
data=Specifies the data values to be written

 

Return-Value

None

DapiDOSet16
This command sets 16 digital outputs simultaneously.

DapiDOSet16

 

Description

This command sets 16 digital outputs simultaneously.

 

Definition

void DapiDOSet16(ULONG handle, ULONG ch, ULONG data);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the output from which writing is to start (0, 16, 32, ..)
data=Specifies the data values to be written

 

Return-Value

None

DapiDOSet32
This command sets 32 digital outputs simultaneously.

DapiDOSet32

 

Description

This command sets 32 digital outputs simultaneously.

 

Definition

void DapiDOSet32(ULONG handle, ULONG ch, ULONG data);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the output from which writing is to start (0, 32, 64, ..)
data=Specifies the data values to be written

 

Return-Value

None

 

Programming example

// Write a value to the outputs
data = 0x0000ff00; // outputs 9-16 are set to 1
DapiDOSet32(handle, 0, data); // Chan Start = 0
printf(“Write to outputs data=0x%x\n”, data);
printf(“key for further\n”);
getch();
// —————————————————-
// Write a value to the outputs
data = 0x80000000; // Output 32 is set to 1
DapiDOSet32(handle, 0, data); // Chan Start = 0
printf(“Write to outputs data=0x%x\n”, data);
printf(“key for further\n”);
getch();
// —————————————————-
// Write a value to the outputs
data = 0x80000000; // Output 64 is set to 1
DapiDOSet32(handle, 32, data); // Chan Start = 32
printf(“Write to outputs data=0x%x\n”, data);
printf(“key for further\n”);
getch();

DapiDOSet64
This command is to set 64 digital outputs.

DapiDOSet64

 

Description

This command sets 64 digital outputs simultaneously.

 

Definition

void DapiDOSet64(ULONG handle, ULONG ch, ULONGLONG data);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the output from which writing is to start (0, 64, ..)
data=Specifies the data values to be written

 

Return-Value

None

DapiDOClrBit32
With this command you can change the states of outputs to 0 without changing the states of the neighboring outputs.

DapiDOClrBit32

 

Description

This command can be used to switch outputs selectively to 0 without changing the states of adjacent outputs.

 

Definition

void DapiDOClrBit32(uint handle, uint ch, uint data);

 

Parameters

handle = This is the handle of an open module
ch = Specifies the number of the output from which writing is to start
data = Specifies the data value to be written (up to 32 bits)

 

Return-Value

None

 

Comment

Only the bits with a value of 1 in the data parameter are considered by the command.

 

Programming example

data = 0x1; // Output 0 would be changed to 0. The states of outputs 1-31 won’t be changed
DapiDOSetBit32(handle, 0, data);

data = 0xf; // Outputs 0-3 would be changed to 0. The states of outputs 4-31 won’t be changed
DapiDOSetBit32(handle, 0, data);

data = 0xff; // Outputs 0-7 would be changed to 0. The states of outputs 8-31 won’t be changed
DapiDOSetBit32(handle, 0, data);

data = 0xff000000; // Outputs 23-31 would be changed to 0. The states of outputs 0-21 won’t be changed
DapiDOSetBit32(handle, 0, data);

DapiDOSet1_WithTimer
This function sets a digital output (ch) to a value (data - 0 or 1) for a specified time in msec.

DapiDOSet1_WithTimer

 

Description

This function sets a digital output (ch) to a value (data – 0 or 1) for a certain time in ms.

 

Definition

void DapiDOSet1_WithTimer(ULONG handle, ULONG ch, ULONG data, ULONG time_ms);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the output to be set (0 .. )
data= Specifies the data value to be written (0 / 1)
time_ms=Specifies the time in which the output is set [ms].

 

Return-Value

None

 

Comment

This command is supported by all output modules of the NET series as well as by our RO-O8-R8 module.
This command loses its validity if it is overwritten with other values.
If you want to deactivate the command, it must be overwritten with time_ms=0.

 

Programming example

DapiDOSet1_WithTimer(handle, 2, 1, 1000);
//Setting channel 2 for 1000msec to 1

DapiDOSetBit32
With this command you can change the states of outputs to 1 without changing the states of the neighboring outputs.

DapiDOSetBit32

 

Description

This command can be used to switch outputs selectively to 1 without changing the states of adjacent outputs.

 

Definition

void DapiDOSetBit32(uint handle, uint ch, uint data);

 

Parameters

handle = This is the handle of an open module
ch = Specifies the number of the output from which writing is to start
data = Specifies the data value to be written (up to 32 bits)

 

Return-Value

None

 

Comment

Only the bits with a value of 1 in the data parameter are considered by the command.

 

Programming example

data = 0x1; // Output 0 would be changed to 1. The states of outputs 1-31 won’t be changed
DapiDOSetBit32(handle, 0, data);

data = 0xf; // Outputs 0-3 would be changed to 1. The states of outputs 4-31 won’t be changed
DapiDOSetBit32(handle, 0, data);

data = 0xff; // Outputs 0-7 would be changed to 1. The states of outputs 8-31 won’t be changed
DapiDOSetBit32(handle, 0, data);

data = 0xff000000; // Outputs 23-31 would be changed to 1. The states of outputs 0-21 won’t be changed
DapiDOSetBit32(handle, 0, data);

DapiDOReadback32
This command reads back the 32 digital outputs.

DapiDOReadback32

 

Description

This command reads back the 32 digital outputs.

 

Definition

ULONG DapiDOReadback32(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the output from which the read back is to be performed (0, 32, 64, ..)

 

Return-Value

Status of 32 outputs.

DapiDOReadback64
This command reads the current PWM frequency of the module

DapiDOReadback32

 

Description

This command reads back the 32 digital outputs.

 

Definition

ULONG DapiDOReadback32(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the output from which the read back is to be performed (0, 32, 64, ..)

 

Return-Value

Status of 32 outputs.

Analog input functions

DapiADSetMode
This is the command to configure the input range of an A/D converter.

DapiADSetMode

 

Description

This command configures the voltage range for an A/D converter.

 

Definition

void DapiADSetMode(ULONG handle, ULONG ch, ULONG mode);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the channel of the A/D converter (0 .. )
mode=Indicates the mode for the channel

 

Return-Value

none

 

Comment

The following modes are supported:
(these depend on the A/D module used)
Unipolar voltages:
ADDA_MODE_UNIPOL_10V
ADDA_MODE_UNIPOL_5V
ADDA_MODE_UNIPOL_2V5
Bipolar voltage:
ADDA_MODE_BIPOL_10V
ADDA_MODE_BIPOL_5V
ADDA_MODE_BIPOL_2V5
Currents:
ADDA_MODE_0_20mA
ADDA_MODE_4_20mA
ADDA_MODE_0_24mA
ADDA_MODE_0_25mA
ADDA_MODE_0_50mA

DapiADGetMode
This command reads the set mode of an A/D converter . For mode description see DapiADSetMode.

DapiADGetMode

 

Description

This command reads back the set mode of an A/D converter. For mode description see DapiADSetMode.

 

Definition

ULONG DapiADGetMode(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the channel of the A/D converter (0 .. )

 

Return-Value

Mode of the A/D converter

DapiADGet
This command reads a data value of one channel of an A/D converter

DapiADGet

 

Description

This command reads a data value from one channel of an A/D converter.

 

Definition

ULONG DapiADGet(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the channel of the A/D converter (0 .. )

 

Return-Value

Value from A/D converter in digits

DapiADGetVolt
This command reads a data value of one channel of an A/D converter in volts.

DapiADGetVolt

 

Description

This command reads a data value from one channel of an A/D converter in volts.

 

Definition

float DapiADGetVolt(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the channel of the A/D converter (0 .. )

 

Return-Value

Value from A/D converter in volts

DapiADGetmA
This command reads a data value of one channel of an A/D converter in mA.

DapiADGetmA

 

Description

This command reads a data value from one channel of an A/D converter in mA.

 

Definition

float DapiADGetmA(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the channel of the A/D converter (0 .. )

 

Return-Value

Value from A/D converter in mA.

 

Comment

This command is module dependent. Of course it only works if the module also supports the power mode.

Analog output functions

DapiDASetMode
This command sets the mode for a D/A converter.

DapiDASetMode

 

Description

This command sets the mode for a D/A converter.

 

Definition

void DapiDASetMode(ULONG handle, ULONG ch, ULONG mode);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the channel of the D/A converter (0 .. )
mode=Gives the mode for the D/A converter

 

Return value

None

 

Comment

The following modes are supported:
(these depend on the D/A module used)
Unipolar voltages:
ADDA_MODE_UNIPOL_10V
ADDA_MODE_UNIPOL_5V
ADDA_MODE_UNIPOL_2V5
Bipolar tensions:
ADDA_MODE_BIPOL_10V
ADDA_MODE_BIPOL_5V
ADDA_MODE_BIPOL_2V5
Currents:
ADDA_MODE_0_20mA
ADDA_MODE_4_20mA
ADDA_MODE_0_24mA
ADDA_MODE_0_25mA
ADDA_MODE_0_50mA

DapiDAGetMode
This command reads back the chosen mode of a D/A converter.

DapiDAGetMode

 

Description

This command reads back the set mode of a D/A converter.

 

Definition

ULONG DapiDAGetMode(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the channel of the D/A converter (0 .. )

 

Return-Value

Mode of the D/A converter

DapiDASet
This command transfers a data value to a channel of a D/A converter.

DapiDASet

 

Description

This command transfers a data value to a channel of a D/A converter.

 

Definition

void DapiDASet(ULONG handle, ULONG ch, ULONG data);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the channel of the D/A converter (0 .. )
data= Specifies the data value that is written

 

Return value

None

DapiDASetVolt
This command sets a voltage to a channel of a D/A converter.

DapiDASetVolt

 

Description

This command sets a voltage to one channel of a D/A converter.

 

Definition

void DapiDASetVolt(ULONG handle, ULONG ch, float data);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the channel of the D/A converter (0 .. )
data=Indicates the voltage to be set [V].

 

Return-Value

None

DapiDASetmA
This command sets a current to a channel of a D/A converter.

DapiDASetmA

 

Description

This command sets a current to one channel of a D/A converter.

 

Definition

void DapiDASetmA(ULONG handle, ULONG ch, float data);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the channel of the D/A converter (0 .. )
data=Indicates the current that is written [mA].

 

Return value

None

 

Comment

This command is module dependent. Of course it only works if the module also supports the power mode.

Analog temperature functions

DapiTempGet
This command reads a temperature channel.

DapiTempGet

 

Description

This command reads a temperature channel.

 

Definition

float DapiTempGet(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the input to be read (0, 1, 2, 3, .. )

 

Return-Value

Temperatur [°C]

 

Programming example

ret=DapiTempGet(handle, 0)
// returns the temperature of channel 0

PWM functions

DapiPWMOutReadback
This command reads the current PWM ratio of one channel

DapiPWMOutReadback

 

Description

This command reads the PWM ratio of a PWM channel

 

Definition

float DapiPWMOutReadback(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the output to be read

 

Return-Value

PWM ratio of the channel from 0% to 100%

 

Programming example

float data = DapiPWMOutReadback(handle, 0);
// Reads the pwm ratio of the first channel
float data = DapiPWMOutReadback(handle, 2);
// Reads the pwm ratio of the second channel

DapiPWMOutSet
This command can set the PWM ratio of one channel

DapiPWMOutSet

 

Description

This command sets the PWM ratio of a PWM channel

 

Definition

void DapiPWMOutSet(ULONG handle, ULONG ch, float data);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the output to be set
data=PWM ratio in from 0% to 100% in 1% steps
Minimum PWM ratio depends on the PWM frequency
10Hz data must be >= 0%.
100Hz data must be >= 2%.
250Hz data must be >= 3%.
1000Hz data must be >= 9%.

 

Return-Value

None

 

Programming example

DapiPWMOutSet(handle, 0, 50);
// Sets the pwm ratio of channel 1 to 50% (50% high, 50% low)
DapiPWMOutSet(handle, 1, 100);
// Sets the pwm ratio of channel 2 to 100% (100% high, 0% low)

DapiSpecialCommand - DAPI_SPECIAL_PWM_FREQ_SET
This command can sets the PWM frequency of the module

DapiSpecialCommand – DAPI_SPECIAL_PWM_FREQ_SET

 

Description

This command sets the PWM frequency of the module

 

Definition

void DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_PWM, cmd, par1, par2);

 

Parameters

handle=This is the handle of an open module
cmd=DAPI_SPECIAL_PWM_FREQ_SET
par1=channel area 0 (ch 0-15), 16 (ch 16-31) … etc.
par2=frequency = DAPI_PWM_FREQUENCY_10HZ, DAPI_PWM_FREQUENCY_100HZ, DAPI_PWM_FREQUENCY_250HZ or DAPI_PWM_FREQUENCY_1000Hz

 

Return-Value

None

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_PWM, DAPI_SPECIAL_PWM_FREQ_SET, 0, DAPI_PWM_FREQUENCY_100HZ);
// Sets the pwm frequency of the module to 100Hz

DapiSpecialCommand - DAPI_SPECIAL_PWM_FREQ_READBACK
This command reads the current PWM frequency of the module

DapiSpecialCommand – DAPI_SPECIAL_PWM_FREQ_READBACK

 

Description

This command reads the current PWM frequency of the module

 

Definition

void DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_PWM, cmd, par1, par2);

 

Parameters

handle=This is the handle of an open module
cmd=DAPI_SPECIAL_PWM_FREQ_READBACK
par1=0
par2=0

 

Return-Value

uint = DAPI_PWM_FREQUENCY_10HZ, DAPI_PWM_FREQUENCY_100HZ, DAPI_PWM_FREQUENCY_250HZ or DAPI_PWM_FREQUENCY_1000Hz

 

Programming example

uint frequency = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_PWM, DAPI_SPECIAL_PWM_FREQ_READBACK, 0, 0);
// Reads the pwm frequency of the module

TTL functions

DapiSpecialCommand - DapiSpecialCMDSetDirDX_8
This command sets the direction of up to 64 consecutive TTL-In/Outputs (8-bit wise). 1-bit case represents 8 TTL-In/Outputs

DapiSpecialCommand – DapiSpecialCMDSetDirDX_1

 

Description

This command sets the direction of 8 consecutive TTL inputs/outputs (1-bit wise).

 

Definition

void DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_SET_DIR_DX_1, ULONG ch, ULONG dir, 0);

 

Parameters

handle = This is the handle of an open module
ch = must always be 0!
dir = Indicates the direction for 8 channels (1=output / 0=input) / Bit 0 stands for channel 0, bit 1 for channel 1 …

 

Return value

None

 

Comment

Not compatible with USB-TTL-32/64.
Use the DAPI_SPECIAL_CMD_SET_DIR_DX_8 command for these modules.

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_1, 0, 0x01 , 0);
// Set Dir of TTL-I/O CH0 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_1, 0, 0x02 , 0);
// Set Dir of TTL-I/O CH1 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_1, 0, 0x04 , 0);
// Set Dir of TTL-I/O CH2 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_1, 0, 0x08 , 0);
// Set Dir of TTL-I/O CH3 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_1, 0, 0x10 , 0);
// Set Dir of TTL-I/O CH4 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_1, 0, 0x20 , 0);
// Set Dir of TTL-I/O CH5 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_1, 0, 0x40 , 0);
// Set Dir of TTL-I/O CH6 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_1, 0, 0x80 , 0);
// Set Dir of TTL-I/O CH7 to output, others to input

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_1, 0, 0x0f , 0);
// Set Dir of TTL-I/O CH0-3 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_1, 0, 0xff , 0);
// Set Dir of TTL-I/O CH0-7 to output, others to input

DapiSpecialCommand - DapiSpecialCMDSetDirDX_1
This command sets the direction of 8 consecutive TTL-In/Outputs (1-bit wise).

DapiSpecialCommand – DapiSpecialCMDSetDirDX_8

 

Description

This command sets the direction of up to 64 consecutive TTL inputs/outputs (8-bit wise).
1-bit represents 8 TTL inputs/outputs.

 

Definition

void DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_SET_DIR_DX_8, ULONG ch, ULONG dir, 0);

 

Parameters

handle = This is the handle of an open module
ch = must always be 0!
dir = (8-bit) indicates the direction for up to 64 consecutive TTL inputs/outputs. (1=output / 0=input)

 

Return-Value

None

 

Comment

Only compatible with USB-TTL-32/64.
For other TTL products use the DAPI_SPECIAL_CMD_SET_DIR_DX_1 command.

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_8, 0, 0x1 , 0);
// Set Dir of TTL-I/O CH0-7 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_8, 0, 0x3 , 0);
// Set Dir of TTL-I/O CH0-15 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_8, 0, 0xc , 0);
// Set Dir of TTL-I/O CH16-31 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_8, 0, 0x33 , 0);
// Set Dir of TTL-I/O CH0-15 and CH32-47 to output, others to input
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SET_DIR_DX_8, 0, 0xff , 0);
// Set Dir of TTL-I/O CH0-63 to output, others to input

timeout protection function

DapiSpecialCommand - DapiSpecialCMDTimeout
This command is used to set the timeout protection function.

DapiSpecialCommand-DapiSpecialCMDTimeout

 

Description

This command is used to set the timeout protection function.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT, cmd, par1, par2);

 

Parameter
handle=This is the handle of an open module
cmd = function to be executed
par1 = value that is passed to the function
par2 = value that is passed to the function

DapiSpecialCommand - DapiSpecialTimeoutSetValueSec
This command is used to set the timeout time.

DapiSpecialCommand – DapiSpecialTimeoutSetValueSec

 

Description
This command is used to set the timeout time.
Definition
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT, cmd, par1, par2);

Parameter
cmd = DAPI_SPECIAL_TIMEOUT_SET_VALUE_SEC
par1 = seconds [s]
par2 = milliseconds [100ms] (value 6 = 600ms)

Comment
The permissible value range of the time specification is between min. 0,1 seconds
and max. 6553 seconds.

 

Programming example
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT,
DAPI_SPECIAL_TIMEOUT_SET_VALUE_SEC, 3, 7);
//The time of the timeout is set to 3.7sec.

DapiSpecialCommand - DapiSpecialTimeoutActivate
This command activates the timeout

DapiSpecialCommand – DapiSpecialTimeoutActivate

 

Description
This command activates the timeout.
Definition
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT, cmd, 0, 0);

Parameter
cmd = DAPI_SPECIAL_TIMEOUT_ACTIVATE

Programming example
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT,
DAPI_SPECIAL_TIMEOUT_ACTIVATE, 0, 0);
//The timeout is activated.

DapiSpecialCommand - DapiSpecialTimeoutDeactivate
This command deactivates the timeout

DapiSpecialCommand – DapiSpecialTimeoutDeactivate

 

Description
This command deactivates the timeout.
Definition
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT, cmd, 0, 0);

Parameter
cmd = DAPI_SPECIAL_TIMEOUT_DEACTIVATE

Programming example
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT,
DAPI_SPECIAL_TIMEOUT_DEACTIVATE, 0, 0);
//The timeout is deactivated.

DapiSpecialCommand - DapiSpecialTimeoutGetStatus
This command is used to read the timeout status

DapiSpecialCommand – DapiSpecialTimeoutGetStatus

 

Description
This command is used to read the timeout status.

Definition
ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT,
DAPI_SPECIAL_TIMEOUT_GET_STATUS, 0, 0);

Parameter
cmd = DAPI_SPECIAL_TIMEOUT_GET_STATUS

Return-Wert
Return = 0 (timeout is deactivated)
Return = 1 (timeout is activated)
Return = 2 (Timeout has occurred)

Programming example
unsigned long status = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT,
DAPI_SPECIAL_TIMEOUT_GET_STATUS, 0, 0);
printf(“Status = %lu\n”, status);
//query of timeout status with output.

DapiSpecialCommand - DapiSpecialTimeoutDoValueMaskWRSet32
This command determines the outputs to be set during a timeout

DapiSpecialCommand – DapiSpecialTimeoutDoValueMaskWRSet32

 

Description
This command determines the outputs to be set during a timeout.
Definition
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT, cmd, ch, par2);

Parameter
cmd = DAPI_SPECIAL_TIMEOUT_DO_VALUE_MASK_WR_SET32
ch = Specifies the number of the output from which writing should start (0, 32, 64, ..)
par2 = [32 Bit] Specifies the outputs which are to be activated at a timeout

Programming example
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT,
DAPI_SPECIAL_TIMEOUT_DO_VALUE_MASK_WR_SET32, 0, 0xff);
//The first 8 relays are switched on in case of timeout.

DapiSpecialCommand - DapiSpecialTimeoutDoValueMaskRDSet32
This command serves to read out the transferred values

DapiSpecialCommand – DapiSpecialTimeoutDoValueMaskRDSet32

 

Description
This command serves to read out the transferred values.

Definition
ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT, cmd, 0, 0);

Parameter
cmd = DAPI_SPECIAL_TIMEOUT_DO_VALUE_MASK_RD_SET32

Return-Value
[32 Bit] Value passed to the SET command

Programming example
long value = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT,
DAPI_SPECIAL_TIMEOUT_DO_VALUE_MASK_RD_SET32, 0, 0);
printf(“%0x\n”, value);
//The value passed to the SET command is read out and displayed.

DapiSpecialCommand - DapiSpecialTimeoutDoValueMaskWRClr32
This command determines the outputs that should be switched off during a timeout

DapiSpecialCommand – DapiSpecialTimeoutDoValueMaskWRClr32

 

Description
This command determines the outputs that should be switched off during a timeout.

Definition
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT, cmd, ch, par2);

Parameter
cmd = DAPI_SPECIAL_TIMEOUT_DO_VALUE_MASK_WR_CLR32
ch = Specifies the number of the output from which writing should start (0, 32, 64, ..)
par2 = [32 Bit] Specifies the outputs to be deactivated in case of a timeout

Programming example
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT,
DAPI_SPECIAL_TIMEOUT_DO_VALUE_MASK_WR_CLR32, 0, 0xff);
//The first 8 relays are switched off.

DapiSpecialCommand - DapiSpecialTimeoutDoValueMaskRDClr32
This command serves to read out the transferred values

DapiSpecialCommand – DapiSpecialTimeoutDoValueMaskRDClr32

 

Description
This command serves to read out the transferred values.

Definition
ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT, cmd, 0, 0);

Parameter
cmd = DAPI_SPECIAL_TIMEOUT_DO_VALUE_MASK_RD_CLR32

Return-Value
[32 Bit] Value passed to the CLR command (in decimal)

Programming example
long value = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT,
DAPI_SPECIAL_TIMEOUT_DO_VALUE_MASK_RD_CLR32, 0, 0);
printf(“%0x\n”, value);
//The value passed to the CLR command is read and displayed.

DapiSpecialCommand - DapiSpecialTimeoutDoValueLoadDefault
Resets the SET and CLR values to the default value

DapiSpecialCommand – DapiSpecialTimeoutDoValueLoadDefault

 

Description
Resets the SET and CLR values to the default value.
(SET-Value = 0, CLR-Value = FFFFFFFF)

Definition
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT, cmd, 0, 0);

Parameter
cmd = DAPI_SPECIAL_TIMEOUT_DO_VALUE_LOAD_DEFAULT

Programming example
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_TIMEOUT,
DAPI_SPECIAL_TIMEOUT_DO_VALUE_LOAD_DEFAULT, 0, 0);
//SET- and CRL- values are set to the default value.

Watchdog functions

DapiWatchdogEnable
This function enables the watchdog.

DapiWatchdogEnable

 

Description

This function activates the watchdog.

 

Definition

void DapiWatchdogEnable(ULONG handle);

 

Parameters

handle=This is the handle of an open module

 

Return-Value

None

 

Programming example

DapiWatchdogEnable(handle);
//Activates the watchdog

DapiWatchdogDisable
This function disables the watchdog.

DapiWatchdogDisable

 

Description

This function deactivates the watchdog.

 

Definition

void DapiWatchdogDisable(ULONG handle);

 

Parameters

handle=This is the handle of an open module

 

Return-Value

None

 

Programming example

DapiWatchdogDisable(handle);
//Deactivates the watchdog

DapiWatchdogRetrigger
This function retriggers the watchdog timer.

DapiWatchdogRetrigger

 

Description

This function retriggers the watchdog timer.

 

Definition

void DapiWatchdogRetrigger(ULONG handle);

 

Parameters

handle=This is the handle of an open module

 

Return-Value

None

 

Programming example

DapiWatchdogRetrigger(handle);
//Retriggers the watchdog timer

Watchdog-Special
This command returns or sets different status information of the Watchdog Stick

Watchdog-Special

 

Description

This function returns or sets various status information of the watchdog stick.

 

Definition

ULONG DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_WATCHDOG, cmd, par1, 0);

 

Parameters

handle=This is the handle of an open module

Querying the timeout relay counter
cmd=DAPI_SPECIAL_WATCHDOG_GET_TIMEOUT_RELAIS_COUNTER_MSEC
par1=0

Querying the watchdog status
cmd=DAPI_SPECIAL_WATCHDOG_GET_STATUS
par1=0

Querying the current timeout time
cmd=DAPI_SPECIAL_WATCHDOG_GET_TIMEOUT_MSEC
par1=0

Querying the watchdog timeout counter
cmd=DAPI_SPECIAL_WATCHDOG_GET_WD_COUNTER_MSEC
par1=0

Setting the time, how long relay 1 is switched
cmd=DAPI_SPECIAL_WATCHDOG_SET_TIMEOUT_REL1_COUNTER_MSEC
par1=Time, how long the 1st relay is switched [ms].

Setting the time, how long relay 2 is switched
cmd=DAPI_SPECIAL_WATCHDOG_SET_TIMEOUT_REL2_COUNTER_MSEC
par1=Time, how long the 2nd relay is switched [ms].

 

Return-Value

Querying the timeout relay counter
return=Elapsed time after a timeout [ms]

Querying the watchdog status
return=Watchdog status
return=0 = Watchdog is deactivated
return=1 = Watchdog is activated
return=2 = Watchdog is retriggered
return=3 = Watchdog timeout

Querying the current timeout time
return=Timeout time [ms]

Querying the watchdog timeout counter
return=Elapsed time without retrigger [ms]

 

Programming example

return = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_WATCHDOG, DAPI_SPECIAL_WATCHDOG_GET_TIMEOUT_RELAIS_COUNTER_MSEC, 0, 0)
//query of the timeout relay counter
return = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_WATCHDOG, DAPI_SPECIAL_WATCHDOG_GET_STATUS, 0, 0);
//query of the watchdog status
return = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_WATCHDOG, DAPI_SPECIAL_WATCHDOG_GET_TIMEOUT_MSEC, 0, 0);
//query of the currently used timeout time
return = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_WATCHDOG, DAPI_SPECIAL_WATCHDOG_GET_WD_COUNTER_MSEC, 0, 0);
//query of the watchdog timeout counter

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_WATCHDOG, DAPI_SPECIAL_WATCHDOG_SET_TIMEOUT_REL1_COUNTER_MSEC, 500, 0);
//switches the 1st relay after a timeout for 500 ms
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_WATCHDOG, DAPI_SPECIAL_WATCHDOG_SET_TIMEOUT_REL1_COUNTER_MSEC, 700, 0);
//switches the 2nd relay after a timeout for 700 ms

Stepper motor functions

DapiStepperCommandEx
This extended command controls stepper motors.

DapiStepperCommandEx

 

Description

This extended command controls stepper motors.

 

Definition

ULONG DapiStepperCommandEx(ULONG handle, ULONG motor, ULONG cmd, ULONG par1, ULONG par2, ULONG par3, ULONG par4, ULONG par5, ULONG par6, ULONG par7);

 

Parameters

handle=This is the handle of an open module
motor=number of the motor to be addressed
cmd=Extended command
par1..7=Extended command dependent parameters (see remark)

 

Comment

See delib.h for the extended commands and associated parameters.

DapiStepperCommand - DapiStepperCmdStop
This command is used to stop the motor, the deceleration slope will be used.

DapiStepperCommand – DapiStepperCmdStop

 

Description

This command is used to stop the motor, the braking ramp is maintained.

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_STOP, 0, 0, 0, 0);

 

Parameters

 

DapiStepperCommand - DapiStepperCommand_GoPosition
With this command the motor will drive to a position. This command can only be used when the motor is not disabled and Go_Position or Go_Reference are not executed.

DapiStepperCommand – DapiStepperCommand_GoPosition

 

Description

This is used to move to a specific position. This command may only be executed if the motor is not disabled and no Go_Position or Go_Reference is executed.

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GO_POSITION, position, 0, 0, 0);

 

Parameters

position=Position to be moved to

 

Programming example

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GO_POSITION , go_pos_par, 0,0,0);

DapiStepperCommand - DapiStepperCommand_GoPosition_Relative
With this command the motor will go to a relative position. In contrast to the command GO_POSITION, which goes to an absolute position, this command considers the current position. This command can only be used when the motor is not disabled and Go_Position or Go_Reference are not executed.

DapiStepperCommand – DapiStepperCommand_GoPosition_Relative

 

Description

This is used to move to a relative position. In contrast to the GO_POSITION command, which moves to an absolute position, the current position is taken into account here. This command may only be executed if the motor is not “disabled” and no Go_Position or Go_Reference is executed.

 

Definition

void DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GO_POSITION_RELATIVE, go_pos_rel_par, 0, 0, 0);

 

Parameters

go_pos_rel_par=Relative position to be approached

 

Programming example

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GO_POSITION_RELATIVE, 100, 0, 0, 0);
//Motor moves 100 steps to the right, seen from the current position.

DapiStepperCommand - DapiStepperCommand_GoRefswitch
The motor goes to the referece position.

DapiStepperCommand – DapiStepperCommand_GoRefswitch

 

Description

The motor moves to the reference position

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GO_REFSWITCH, par1, par2, par3, 0);

 

Parameters

Possible values for par1: (if several are needed, the individual values must be added together)
DAPI_STEPPER_GO_REFSWITCH_PAR_REF1
DAPI_STEPPER_GO_REFSWITCH_PAR_REF2
DAPI_STEPPER_GO_REFSWITCH_PAR_REF_LEFT
DAPI_STEPPER_GO_REFSWITCH_PAR_REF_RIGHT
DAPI_STEPPER_GO_REFSWITCH_PAR_REF_GO_POSITIVE
DAPI_STEPPER_GO_REFSWITCH_PAR_REF_GO_NEGATIVE
DAPI_STEPPER_GO_REFSWITCH_PAR_SET_POS_0
par2=Motor position offset (1/16 full step)
par3=Timeout time [ms]

 

Comment

Approaching the reference switch
First the motor moves to reference position 1 or 2 (see par1).
Here you can specify whether reference switch 1 (DAPI_STEPPER_GO_REFSWITCH_PAR_REF1) or reference switch 2 (DAPI_STEPPER_GO_REFSWITCH_PAR_REF2) is approached.

The direction in which the motor starts can be selected. With the parameter DAPI_STEPPER_GO_REFSWITCH_PAR_REF_GO_NEGATIVE the motor starts to the left and with the parameter DAPI_STEPPER_GO_REFSWITCH_PAR_REF_GO_POSITIVE the motor starts to the right.

The speed GOREFERENCEFREQUENCY_TOENDSWITCH is used here (see DapiStepperCommand_SetMotorcharacteristic).

Moving out of the reference switch
Then the motor moves out of the reference position at the speed GOREFERENCEFREQUENCY_AFTERENDSWITCH. It can be selected whether the motor moves to the right or left side of the reference switch. With the parameter DAPI_STEPPER_GO_REFSWITCH_PAR_REF_LEFT the left edge is approached and with the parameter DAPI_STEPPER_GO_REFSWITCH_PAR_REF_RIGHT the right edge is approached.

Optional approach of an offset
After moving out of the reference switch an offset can still be approached. If this parameter is not = 0 (par2), the motor moves to this offset at the speed GOREFERENCEFREQUENCY_TOOFFSET.

Zeroing the position of the motor
With the parameter DAPI_STEPPER_GO_REFSWITCH_PAR_SET_POS_0 you can additionally set whether the motor now gets the position 0.

 

Programming example

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GO_REFSWITCH, DAPI_STEPPER_GO_REFSWITCH_PAR_REF1 + DAPI_STEPPER_GO_REFSWITCH_PAR_REF_LEFT + DAPI_STEPPER_GO_REFSWITCH_PAR_REF_GO_POSITIVE + DAPI_STEPPER_GO_REFSWITCH_PAR_SET_POS_0, 0, 15000, 0);

DapiStepperCommand - DapiStepperCommand_Fullstop
This command is used to stop the motors immediately without using the the deceleration slope. After this command the motor position might be ignorred because the motor has been stopped uncontrolled.

DapiStepperCommand – DapiStepperCommand_Fullstop

 

Description

This command is used to stop the motor immediately, the braking ramp is not maintained. The motor position may not be correct afterwards, because the motor is stopped uncontrolled.

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_FULLSTOP, 0, 0, 0, 0);

 

Parameters

 

Programming example

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_FULLSTOP , 0, 0, 0, 0);

DapiStepperCommand - DapiStepperCommand_Disable
This command ist used to disable/enable the motor. The motor stops or starts driving. This command can be only used when the motor stopped.

DapiStepperCommand – DapiStepperCommand_Disable

 

Description

This command is used to disable/enable the motor, the motor will then no longer move/or move again. This command may only be used when the motor is at a standstill.

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_DISABLE, par1, 0, 0, 0);

 

Parameters

par1=Disablemode (0=Normal function / 1=Disable)

DapiStepperCommand - DapiStepperCommand_SetPosition
This command ist used to set the motor position. The resolution ist 1/16 Full-step. This command may be used anytime.

DapiStepperCommand – DapiStepperCommand_SetPosition

 

Description

This command is used to set the motor position. The resolution is 1/16 full step. This command may only be used when the motor is stopped.

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_POSITION, par1, 0, 0, 0);

 

Parameters

par1=Motorposition

DapiStepperCommand - DapiStepperCommand_SetFrequency
This command is used to set the motor reference frequency. The motor frequency regulation takes on the compliance of the acceleration and deceleration slope. Step losses do not occur. The motor reference frequency is related to the full-step-mode. The direction will be defined by the prefix. If the motor reference frequency is higher than the maximum frequency, the command is ignored. With closed Endswitch1 the motor can only drive in positive direction, with closed Endswitch2 the motor can only drive in negative direction, otherwise the command is ignored.

DapiStepperCommand – DapiStepperCommand_SetFrequency

 

Description

This command is used to set the motor reference frequency. The motor frequency control ensures that the acceleration / braking ramp is maintained. Step losses do not occur. The motor setpoint frequency is related to full step operation. The direction is selected via the sign.
The motor setpoint frequency must not exceed the maximum frequency, otherwise the command is rejected.
When limit switch 1 is closed, it is only possible to move in positive direction, when limit switch 2 is closed, it is only possible to move in negative direction, otherwise the command is rejected.

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_FREQUENCY, par1, 0, 0, 0);

 

Parameters

par1=Motor nominal frequency [Hz]

DapiStepperCommand - DapiStepperCommand_SetFrequencyDirectly
This command is used to set the motor frequency. The motor frequency regulation takes no funktion on the compliance of the acceleration and deceleration slope. The user is responsible. Step losses can occur. The motor reference frequency is related to the full-step. The direction can be defined by the prefix.

DapiStepperCommand – DapiStepperCommand_SetFrequencyDirectly

 

Description

This command is used to set the motor frequency. The motor frequency control has no function. The user is responsible for maintaining the acceleration / braking ramp. Step losses can occur if this is not observed.
The motor frequency is related to full step operation. The direction is selected via the sign.

The frequency must not exceed the maximum frequency.

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_FREQUENCY_DIRECTLY, par1, 0 ,0 ,0);

 

Parameters

par1=Motor frequency [Hz]

DapiStepperCommand - DapiStepperCommand_GetFrequency
This command is used to read the motor frequency. This command can be used everytime.

DapiStepperCommand – DapiStepperCommand_GetFrequency

 

Description

This command is used to query the motor frequency. This command may always be used.

 

Definition

ULONG DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_FREQUENCY, 0, 0 ,0 ,0);

 

Parameters

 

Return-Value

Motor frequency [Hz]

DapiStepperCommand - DapiStepperCommand_SetMotorcharacteristic
With this command, you can set motor characteristics.

DapiStepperCommand – DapiStepperCommand_SetMotorcharacteristic

 

Description

This is used to set new motor configurations

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC, par1, par2, 0, 0);

 

Parameters

Set parameter step mode
par1=DAPI_STEPPER_MOTORCHAR_PAR_STEPMODE
par2=0 (full step mode)
par2=1 (half step operation)
par2=2 (quarter step mode)
par2=3 (eight-step operation)
par2=4 (sixteenth step operation)

Set parameter GO frequency
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOFREQUENCY
par2=Speed [full step / s] – related to full step frequency – (maximum value=5000)

Set parameter start frequency
par1=DAPI_STEPPER_MOTORCHAR_PAR_STARTFREQUENCY
par2=Start frequency [full step / s] – related to full step frequency – (maximum value=5000)

Parameter-Stop-Frequency setzen
par2=Start frequency [full step / s] – related to full step frequency – (maximum value=5000)
par2=Stop frequency [full step / s] – related to full step frequency – (maximum value=5000)

Set Parameter Max Frequency
par1=DAPI_STEPPER_MOTORCHAR_PAR_MAXFREQUENCY
par2=Maximum frequency [full step / s] – related to full step frequency – (maximum value=5000)

Set parameter acceleration loop
par1=DAPI_STEPPER_MOTORCHAR_PAR_ACCELERATIONSLOPE
par2=acceleration ramp [full step / 10ms] – (maximum value=1000)

Set parameter deceleration loop
par1=DAPI_STEPPER_MOTORCHAR_PAR_DECELERATIONSLOPE
par2= braking ramp [full step / 10ms] – (maximum value=1000)

Set parameter phase current
par1=DAPI_STEPPER_MOTORCHAR_PAR_PHASECURRENT
par2=Phase current [mA] – (maximum value = 1500)

Parameter-Hold-Phasecurrent setzen
par1=DAPI_STEPPER_MOTORCHAR_PAR_HOLDPHASECURRENT
par2=Phase current at motor standstill [mA] – (maximum value=1500)

Set parameter hold time
par1=DAPI_STEPPER_MOTORCHAR_PAR_HOLDTIME
par2=Time in which the holding current flows after motor stop [ms]
par2=-1 / FFFF hex / 65535 dec (infinite time)

Set parameter status LED mode
par1=DAPI_STEPPER_MOTORCHAR_PAR_STATUSLEDMODE
par2=Operating mode of the status LED
par2=0 = (MOVE – LED lights up during motor movement)
par2=1 = (STOP – LED lights up when motor is stopped)
par2=2 = (ENDSW1 – LED lights up when limit switch1 is closed)
par2=3 = (ENDSW2 – LED lights up when limit switch2 is closed)
par2=4 = (REFSW1 – LED lights up when reference switch1 is closed)
par2=5 = (REFSW2 – LED lights up when reference switch2 is closed)

Set parameter invert-END switch1
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_ENDSW1
par2=invert Function of limit switch1 (0=normal / 1=invert)

Set parameter invert-END switch2
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_ENDSW2
par2=invert Function of limit switch2 (0=normal / 1=invert)

Set Parameter Invert Ref Switch1
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_REFSW1
par2=invert Function of reference switch1 (0=normal / 1=invert)

Set Parameter Invert Ref Switch2
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_REFSW2
par2=invert Function of reference switch2 (0=normal / 1=invert)

Set parameter invert direction
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_DIRECTION
par2=Invert all directions (0=normal / 1=invert)

Set parameter end switch stop mode
par1= DAPI_STEPPER_MOTORCHAR_PAR_ENDSWITCH_STOPMODE
par2=Setting the stop behaviour (0=full stop / 1=stop)

Set Parameter-GoReferenceFrequency (ATTENTION: This parameter is no longer supported!)
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY
Note: This parameter is completely replaced by the following three parameters.

Set parameter GoReferenceFrequnecyToEndSwitch
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_TOENDSWITCH
par2=speed at which the switch is approached (frequency [full step / s] – (maximum value=5000))

 

Parameter

GoReferenceFrequencyAfterEndSwitch setzen
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_AFTERENDSWITCH
par2=speed at which the switch is driven down (frequency [full step / s] – (maximum value=5000)

Set GoReferenceFrequencyToOffset parameter
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_TOOFFSET
par2=Speed at which the optional offset is approached (frequency [full step / s] – (maximum value=5000))

 

Programming example

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_STEPMODE, 4,0,0); // step mode (full, half, quarter, eighth, sixteenth step)
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_GOFREQUENCY , 1000,0,0); // Step mode at motor stop (full, half, quarter, eighth, sixteenth step)
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_STARTFREQUENCY, 100,0,0); // Start frequency [full step / s].
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_STOPFREQUENCY , 100,0,0); // Stop frequency [full step / s].
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_MAXFREQUENCY , 3500,0,0); // maximum frequency [full step / s].
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_ACCELERATIONSLOPE, 20,0,0); // Acceleration in [full steps / ms].
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_DECELERATIONSLOPE, 20,0,0); // Braking in [full steps / ms].
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_PHASECURRENT, 750,0,0); // Phase current [mA]
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_HOLDPHASECURRENT, 500,0,0); // Phase current at motor standstill [mA]
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_HOLDTIME, 15000,0,0); // Time in which the holding current flows after motor stop [s]
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_STATUSLEDMODE, 0,0,0); // Operating mode of the status LED
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_INVERT_ENDSW1, 0,0,0); // invert function of limit switch1
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_INVERT_ENDSW2, 0,0,0); // invert function of limit switch2
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_INVERT_REFSW1, 0,0,0); // invert function of reference switch1
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_INVERT_REFSW2, 0,0,0); // invert function of reference switch2
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_INVERT_DIRECTION, 0,0,0); // invert all directions
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_ENDSWITCH_STOPMODE, 0,0,0); // set the stop behaviour
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_TOENDSWITCH, 100,0,0); //Adjustment of the speed with which the limit switch is approached.
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_AFTERENDSWITCH , 200,0,0); //Adjustment of the speed at which the limit switch is driven away.
DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_TOOFFSET , 300,0,0); //Adjustment of the speed at which the machine is moved to the optional offset.

DapiStepperCommand - DapiStepperCommand_GetMotorcharacteristic
With this command, motor specific parameter can be read. This command may be used everytime. It is splitted in sub commands, that are analog to the parameters of the DAPI_STEPPER_CMD_SET_MOTORCHARATERISTIC

DapiStepperCommand – DapiStepperCommand_GetMotorcharacteristic

 

Description

This is used to read out the motor-specific parameter. This command may always be used. It is divided into subcommands that are analogous to the parameters of DAPI_STEPPER_CMD_SET_MOTORCHARACTERISTIC.

 

Definition

ULONG DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC, par1, 0, 0, 0);

 

Parameters

Query parameter step mode
par1=DAPI_STEPPER_MOTORCHAR_PAR_STEPMODE

Query parameter GO frequency
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOFREQUENCY

Query parameter start frequency
par1=DAPI_STEPPER_MOTORCHAR_PAR_STARTFREQUENCY

Query parameter stop frequency
par1=DAPI_STEPPER_MOTORCHAR_PAR_STOPFREQUENCY

Query Parameter Max Frequency
par1=DAPI_STEPPER_MOTORCHAR_PAR_MAXFREQUENCY

Query Parameter Accelerationslope
par1=DAPI_STEPPER_MOTORCHAR_PAR_ACCELERATIONSLOPE

Query parameter deceleration loop
par1=DAPI_STEPPER_MOTORCHAR_PAR_DECELERATIONSLOPE

Query parameter phase current
par1=DAPI_STEPPER_MOTORCHAR_PAR_PHASECURRENT

Query parameter hold phase current
par1=DAPI_STEPPER_MOTORCHAR_PAR_HOLDPHASECURRENT

Query parameter hold time
par1=DAPI_STEPPER_MOTORCHAR_PAR_HOLDTIME

Query parameter status LED mode
par1=DAPI_STEPPER_MOTORCHAR_PAR_STATUSLEDMODE

Query parameter invert-END switch1
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_ENDSW1

Query parameter invert-END switch2
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_ENDSW2

Query Parameter Invert Ref Switch1
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_REFSW1

Query Parameter Invert Ref Switch2
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_REFSW2

Query parameter invert direction
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_DIRECTION

Query parameter end switch stop mode
par1= DAPI_STEPPER_MOTORCHAR_PAR_ENDSWITCH_STOPMODE

Query Parameter-GoReferenceFrequency (ATTENTION: This parameter is no longer supported!)
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY
Note: This parameter is completely replaced by the following three parameters.

Query Parameter-GoReferenceFrequnecyToEndSwitch
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_TOENDSWITCH

Query parameter GoReferenceFrequencyAfterEndSwitch
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_AFTERENDSWITCH

Get parameter GoReferenceFrequencyToOffSet
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_TOOFFSET

Return value

Query parameter step mode
par1=DAPI_STEPPER_MOTORCHAR_PAR_STEPMODE
return=0 (full step mode)
return=1 (half step operation)
return=2 (quarter step mode)
return=3 (eight-step mode)
return=4 (sixteenth step mode)

Query parameter GO frequency
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOFREQUENCY
return=speed [full step / s] – related to full step

Query parameter start frequency
par1=DAPI_STEPPER_MOTORCHAR_PAR_STARTFREQUENCY
return=Start frequency [full step / s]

Query parameter stop frequency
par1=DAPI_STEPPER_MOTORCHAR_PAR_STOPFREQUENCY
return=Stop frequency [full step / s].

Query Parameter Max Frequency
par1=DAPI_STEPPER_MOTORCHAR_PAR_MAXFREQUENCY
return=maximum frequency [full step / s].

Query Parameter Accelerationslope
par1=DAPI_STEPPER_MOTORCHAR_PAR_ACCELERATIONSLOPE
return=acceleration ramp [full step / 10ms].

Query parameter deceleration loop
par1=DAPI_STEPPER_MOTORCHAR_PAR_DECELERATIONSLOPE
return=Braking ramp [full step / 10ms].

Query parameter phase currents
par1=DAPI_STEPPER_MOTORCHAR_PAR_PHASECURRENT
return=Phase current [mA]

Query parameter hold phase current
par1=DAPI_STEPPER_MOTORCHAR_PAR_HOLDPHASECURRENT
return= Phase current at motor standstill [mA]

Query parameter hold time
par1=DAPI_STEPPER_MOTORCHAR_PAR_HOLDTIME
return=Time in which the holding current flows after motor stop [ms].

Query parameter status LED mode
par1=DAPI_STEPPER_MOTORCHAR_PAR_STATUSLEDMODE
return=Operating mode of the status LED
return=0 (MOVE – LED lights up during motor movement)
return=1 (STOP – LED lights up when the motor is stopped)
return=2 (ENDSW1 – LED lights up when limit switch1 is closed)
return=3 (ENDSW2 – LED lights up when limit switch2 is closed)
return=4 (REFSW1 – LED lights up when reference switch1 is closed)
return=5 (REFSW2 – LED lights up when reference switch2 is closed)

Query parameter invert-END switch1
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_ENDSW1
return=limit switch1 is inverted (0=normal / 1=invert)

Query parameter invert-END switch2
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_ENDSW2
return=limit switch2 is inverted (0=normal / 1=invert)

Query Parameter Invert Ref Switch1
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_REFSW1
return=Reference switch1 is inverted (0=normal / 1=inverted)

Query Parameter Invert Ref Switch2
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_REFSW2
return=Reference switch2 is inverted (0=normal / 1=inverted)

Querying the Parameter Invert Direction
par1=DAPI_STEPPER_MOTORCHAR_PAR_INVERT_DIRECTION
return=Directions are inverted (0=normal / 1=invert)

Query parameter end switch stop mode
par1=DAPI_STEPPER_MOTORCHAR_PAR_ENDSWITCH_STOPMODE
return=Setting of the stop behaviour (0=Fullstop / 1=Stop)

Query Parameter-GoReferenceFrequnecyToEndSwitch
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_TOENDSWITCH
return=Frequency [full step / s]

Query parameter GoReferenceFrequencyAfterEndSwitch
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_AFTERENDSWITCH
return=Frequency [full step / s]

Query parameter GoReferenceFrequencyToOffset
par1=DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_TOOFFSET
return=Frequency [full step / s]

 

Programming example

value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_STEPMODE, 0, 0, 0); // Step mode (full, half, quarter, eighth, sixteenth step)
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_GOFREQUENCY , 0,0,0); // Step mode at motor stop (full, half, quarter, eighth, sixteenth step)
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_STARTFREQUENCY , 0,0,0); // Start frequency [full step / s]; // Start frequency [full step / s
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_STOPFREQUENCY , 0,0,0); // Stop frequency [full step / s].
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_MAXFREQUENCY , 0,0,0); // maximum frequency [full step / s].
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_ACCELERATIONSLOPE, 0,0,0); // Acceleration in [full steps / ms].
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_DECELERATIONSLOPE, 0,0,0); // Braking in [full steps / ms].
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_PHASECURRENT, 0,0,0); // Phase current [mA]
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_HOLDPHASECURRENT, 0,0,0); // Phase current at motor standstill [mA]
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_HOLDTIME, 0,0,0); // Time in which the holding current flows after motor stop [s]
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_STATUSLEDMODE, 0,0,0); // Operation mode of the status LED
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_INVERT_ENDSW1, 0,0,0); // invert function of limit switch1
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_INVERT_ENDSW2, 0,0,0); // invert function of limit switch12
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_INVERT_REFSW1, 0,0,0); // invert function of reference switch1
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_INVERT_REFSW2, 0,0,0); // invert function of reference switch2
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_INVERT_DIRECTION, 0,0,0); // invert all directions
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC , DAPI_STEPPER_MOTORCHAR_PAR_ENDSWITCH_STOPMODE, 0,0,0); // set the stop behaviour
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC ,
DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_TOENDSWITCH, 0,0,0); // Query the speed at which the limit switch is approached.
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC ,
DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_AFTERENDSWITCH, 0,0,0); // Query the speed at which the limit switch is moved away.
value = DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTORCHARACTERISTIC ,
DAPI_STEPPER_MOTORCHAR_PAR_GOREFERENCEFREQUENCY_TOOFFSET, 0,0,0); // Query the speed at which the optional offset is approached.

DapiStepperCommand - DapiStepperCommand_MotorcharacteristicLoadDefault
The characteristic of the motor is set back to default.

DapiStepperCommand – DapiStepperCommand_MotorcharacteristicLoadDefault

 

Description

The motor characteristics of the motor are reset to default values.

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_MOTORCHARACTERISTIC_LOAD_DEFAULT, 0, 0, 0, 0);

 

Parameters

 

Comment

The default values are as follows:
– Step mode: Full step
– Step frequency at GoPosition [full step / s]: 1000 Hz
– Start frequency [full step / s]: 200Hz
– Stop frequency [full step / s]: 200Hz
– Maximum step frequency [full step / s]: 3000Hz
– Acceleration ramp [Hz/10ms]: 10Hz/10ms
– Braking ramp [Hz/10ms]: 10Hz/10ms
– Phase current 0..1.5A [1mA]: 750mA
– Holding current 0..1.5A [1mA]: 500mA
– Holding time 0..infinite [ms]: 15000ms
– Status_LED function: Move
– Function of limit switch1: not inverted
– Function of limit switch2: not inverted
– Function of reference switch1: not inverted
– Function of reference switch2: not inverted
– Function of all directions: not inverted
– Limit switch mode: Fullstop
– Step frequency at GoReference [full step / s]: 1000 Hz

DapiStepperCommand - DapiStepperCommand_MotorcharacteristicEEPROMSave
The current motor characteristic will be stored in the EEPROM.

DapiStepperCommand – DapiStepperCommand_MotorcharacteristicEEPROMSave

 

Description

The current motor characteristic of the motor is stored in the EEPROM.

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_MOTORCHARACTERISTIC_EEPROM_SAVE, 0, 0, 0, 0);

 

Parameters

DapiStepperCommand - DapiStepperCommand_MotorcharacteristicEEPROMLoad
The motor characteristic can be loaded from the EEPROM.

DapiStepperCommand – DapiStepperCommand_MotorcharacteristicEEPROMLoad

 

Description

The motor characteristics of the motor are loaded from the EEPROM.

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_MOTORCHARACTERISTIC_EEPROM_LOAD, 0, 0, 0, 0);

 

Parameters

DapiStepperCommand - DapiStepperCommand_GetCPUTemp
The temperature of the CPU can be read.

DapiStepperCommand – DapiStepperCommand_GetCPUTemp

 

Description

The temperature of the CPU is queried.

 

Definition

ULONG DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_CPU_TEMP, 0, 0, 0, 0);

 

Parameters

cmd=DAPI_STEPPER_CMD_GET_CPU_TEMP

 

Return-Value

Temperatur [°C]

DapiStepperCommand - DapiStepperCommand_GetMotorSupplyVoltage
The voltage supply of the motor can be read.

DapiStepperCommand – DapiStepperCommand_GetMotorSupplyVoltage

 

Description

This is used to query the supply voltage of the motor.

 

Definition

DapiStepperCommand(handle, motor, DAPI_STEPPER_CMD_GET_MOTOR_SUPPLY_VOLTAGE, 0, 0, 0, 0);

 

Parameters

cmd=DAPI_STEPPER_CMD_GET_MOTOR_SUPPLY_VOLTAGE

 

Return-Value

Motor supply voltage in [mV]

DapiStepperGetStatus - DapiStepperGetStatus_GetPosition
With this command the motor position can be read.

DapiStepperGetStatus – DapiStepperGetStatus_GetPosition

 

Description

This is used to read a specific position

 

Definition

ULONG DapiStepperGetStatus(handle, motor, cmd);

 

Parameters

cmd=DAPI_STEPPER_STATUS_GET_POSITION

 

Return-Value

The current motor position is returned in 1/16 step units

 

Programming example

value = DapiStepperGetStatus(handle, motor, DAPI_STEPPER_STATUS_GET_POSITION);

DapiStepperGetStatus - DapiStepperGetStatus_GetSwitch
With this command, the status of the switches can be read.

DapiStepperGetStatus – DapiStepperGetStatus_GetSwitch

 

Description

This is used to query the status of the switches

 

Definition

ULONG DapiStepperGetStatus(handle, motor, cmd);

 

Parameters

cmd=DAPI_STEPPER_STATUS_GET_SWITCH

 

Return-Value

The status of the switches is returned:
Bit0: ENDSCHALTER1; 1 = Limit switch1 is closed
Bit1: LIMIT SWITCH2; 1 = Limit switch2 is closed
Bit2: REFERENCE SWITCH1; 1 = reference switch1 is closed
Bit3: REFERENCE SWITCH2; 1 = Reference switch2 is closed

 

Programming example

pos = DapiStepperGetStatus(handle, motor, DAPI_STEPPER_STATUS_GET_SWITCH);

DapiStepperGetStatus - DapiStepperGetStatus_GetActivity
With this command, some status informations (e.g. activity of the motor phase current) can be read.

DapiStepperGetStatus – DapiStepperGetStatus_GetActivity

 

Description

This is used to request various status information (e.g. the activity of the motor current, etc.)

 

Definition

ULONG DapiStepperGetStatus(handle, motor, DAPI_STEPPER_STATUS_GET_ACTIVITY);

 

Parameters

handle=This is the handle of an open module
motor=number of the motor to be addressed

 

Return-Value

Bit Command Description

0 DISABLE motor must not move
1 MOTOR CURRENT ACTIVE Motor current is active
2 HOLDING CURRENT ACTIVE Holding current is active
3 GOPOSITIONACTIV GoPosition is active
4 GOPOSITION BRAKE GoPosition Braking is active
5 GOREFERENZACTIV GoReference is active

 

Programming example

ret = DapiStepperGetStatus(handle, motor, DAPI_STEPPER_STATUS_GET_ACTIVITY);

Software FIFO-functions

DapiSpecialCommand - DapiSpecialCMDSWFifo
This command is used to set the software FIFO of the NET-Modules

DapiSpecialCommand-DapiSpecialCMDSWFifo

 

Description

This command is used to set the software FIFO.
DAPI_SPECIAL_CMD_SW_FIFO commands only work with the NET series.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, par2);

 

Parameters

handle = This is the handle of an open module
cmd = function to be executed
fifo_instance = Specifies the instance of the software FIFO. So far there is only instance 0
par2 = value that is passed to the function

Remark

Always define the submodule first with the DapiSpecialSWFifoSetSubmodule command!

DapiSpecialCommand - DapiSpecialSWFifoSetSubmodule
This command specifies to which submodule the data of the software FIFO are transferred

DapiSpecialCommand-DapiSpecialSWFifoSetSubmodule

 

Description

This command specifies to which submodule the data of the software FIFO are transferred.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, par2);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_SET_SUBMODULE
fifo_instance = Specifies the instance of the software FIFO
par2 = indicates the number of the submodule (0, 1, 2, 3, …)

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_SET_SUBMODULE, fifo_instance, 2);
//The software FIFO transfers the data to submodule 2.

DapiSpecialCommand - DapiSpecialSWFifoGetSubmodule
This command returns the number of the submodule to which the data is transferred

DapiSpecialCommand – DapiSpecialSWFifoGetSubmodule

 

Description

This command returns the number of the submodule to which the data is transferred.

 

Definition

ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_GET_SUBMODULE
fifo_instance = Specifies the instance of the software FIFO

 

Return value

Number of the submodule (0, 1, 2, 3, …)

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_SET_SUBMODULE, fifo_instance, 2);
//The software FIFO transfers the data to submodule 2.

DapiSpecialCommand - DapiSpecialSWFifoActivate
This command activates the Fifo data transfer within the NET modules.

DapiSpecialCommand-DapiSpecialSWFifoActivate

 

Description

This command activates the Fifo data transfer within the NET modules.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_ACTIVATE
fifo_instance = Specifies the instance of the software FIFO

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_ACTIVATE, fifo_instance, 0);
//The automatic output of the D/A converter is activated.

DapiSpecialCommand - DapiSpecialSWFifoDeactivate
This command deactivates the Fifo data transfer within the NET modules

DapiSpecialCommand-DapiSpecialSWFifoDeactivate

 

Description

This command deactivates the Fifo data transfer within the NET modules.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_DEACTIVATE
fifo_instance = Specifies the instance of the software FIFO

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_DEACTIVATE, fifo_instance, 0);
//The automatic output of the D/A converter is deactivated.

DapiSpecialCommand - DapiSpecialSWFifoGetActivity
This command gets the status of the FIFO transmission to the D/A converter (whether active or inactive)

DapiSpecialCommand – DapiSpecialSWFifoGetActivity

 

Description

This command gets the status of the FIFO transmission to the D/A converter (whether active or inactive).

 

Definition

ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_GET_ACTIVITY
fifo_instance = Specifies the instance of the software FIFO

 

Return value

Return = 0 (transmission is deactivated)
Return = 1 (transmission is activated)

 

Programming example

unsigned long ret = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_GET_ACTIVITY, fifo_instance, 0);
printf(“Status = %lu\n”, ret);
//transfer status is retrieved

DapiSpecialCommand - DapiSpecialSWFifoInitAndClear
This command deletes existing data from the software FIFO memory and returns the FIFO mechanism to its original state

DapiSpecialCommand – DapiSpecialSWFifoInitAndClear

 

Description

This command deletes existing data from the software FIFO memory and returns the FIFO mechanism to its original state.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_INIT_AND_CLEAR
fifo_instance = Specifies the instance of the software FIFO

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_INIT_AND_CLEAR, fifo_instance, 0);
//existing data is deleted from the FIFO memory.

DapiSpecialCommand - DapiSpecialSWFifoIOActivate
This command activates the FIFO I/O input/output.

DapiSpecialCommand – DapiSpecialSWFifoIOActivate

 

Description

This command activates the FIFO I/O input/output.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_IO_ACTIVATE
fifo_instance = Gibt die Instanz des Software FIFO an

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_IO_ACTIVATE, fifo_instance, 0);
//The automatic output of the FIFO to the module is activated.

DapiSpecialCommand - DapiSpecialSWFifoIODeactivate
This command disables the FIFO I/O input/output.

DapiSpecialCommand – DapiSpecialSWFifoIODeactivate

 

Description

This command disables the FIFO I/O input/output.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_IO_DEACTIVATE
fifo_instance = Gibt die Instanz des Software FIFO an

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_IO_DEACTIVATE, fifo_instance, 0);
//The automatic output of the FIFO to the module is deactivated.

DapiSpecialCommand - DapiSpecialSWFifoSetChannel
This command specifies the A/D channels to which the FIFO data is to be transferred, specifying the start and end channels

DapiSpecialCommand – DapiSpecialSWFifoSetChannel

 

Description

This command specifies the A/D channels to which the FIFO data is to be transferred, specifying the start and end channels.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, ch);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_SET_CHANNEL
fifo_instance = Specifies the instance of the software FIFO
ch = specification of the start and end channel

 

Programming example

unsigned long ch_start = 0; //Start with D/A Channel 0
unsigned long ch_end = 1; //End with D/A Channel 1

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_SET_Channel, fifo_instance,
((ch_end << 8) & 0xff00) | (ch_start & 0xff);
//The start and end channel is defined

DapiSpecialCommand - DapiSpecialSWFifoGetChannel
This command shows the D/A channels to which the data is transferred

DapiSpecialCommand-DapiSpecialSWFifoGetChannel

 

Description

This command shows the D/A channels to which the data is transferred.

 

Definition

ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_GET_CHANNEL
fifo_instance = Specifies the instance of the software FIFO

 

Return value

Number of the A/D channels
Bit 0-7 Start channel
Bit 8-15 End channel

 

Programming example

unsigned long ret = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_GET_CHANNEL, fifo_instance, 0);
printf(“Channel = %lu\n”, ret);
//Shows on which A/D channels the data is transferred.

DapiSpecialCommand - DapiSpecialSWFifoSetFrequencyHz
This command specifies the frequency interval (in Hertz) from the FIFO to the module

DapiSpecialCommand-DapiSpecialSWFifoSetFrequencyHz

 

Description

This command specifies the frequency interval (in Hertz) from the FIFO to the module.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, par2);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_SET_FREQUENCY_HZ
fifo_instance = Specifies the instance of the software FIFO
par2 = frequency interval in Hertz (Hz)

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_SET_FREQUENCY_HZ, fifo_instance, 10);
//Sets the frequency interval to 10Hz.

DapiSpecialCommand - DapiSpecialSWFifoGETFrequencyHz
This command returns the previously set frequency interval in Hertz

DapiSpecialCommand-DapiSpecialSWFifoGETFrequencyHz

 

Description

This command returns the previously set frequency interval in Hertz.

 

Definition

ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_GET_FREQUENCY_HZ
fifo_instance = Specifies the instance of the software FIFO

 

Return value

Frequency interval in Hertz (Hz)

 

Programming example

unsigned long ret = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_GET_FREQUENCY_HZ, fifo_instance, 0);
printf(“Frequency = %lu (Hz)\n”, ret);
//Displays the previously set frequency interval.

DapiSpecialCommand - DapiSpecialSWFifoGetBytesFree
This command is used to read the free bytes in the software FIFO buffer

DapiSpecialCommand-DapiSpecialSWFifoGetBytesFree

 

Description

This command is used to read the free bytes in the software FIFO buffer.

 

Definition

ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_GET_BYTES_FREE
fifo_instance = Specifies the instance of the software FIFO

 

Return value

Free bytes of the software FIFO

 

Programming example

unsigned long ret = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_GET_BYTES_FREE, fifo_instance, 0);
printf(“Free memory = %lu\n”, ret);
//Output the remaining free bytes of the memory.

DapiSpecialCommand - DapiSpecialSWFifoGetBytesPerSample
This command specifies how many bytes are required for writing to the D/A converter

DapiSpecialCommand-DapiSpecialSWFifoGetBytesPerSample

 

Description

This command specifies how many bytes are required for writing to the D/A converter.
Example: If 3 D/A channels are written to a 16 bit (2 byte) D/A converter, 3×2 bytes are required per sample. So the value 6 will be returned.

 

Definition

ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_GET_BYTES_PER_SAMPLE
fifo_instance = Specifies the instance of the software FIFO

 

Return value

Bytes required per sample

 

Programming example

unsigned long ret = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_GET_BYTES_PER_SAMPLE, fifo_instance, 0);
printf(“Required bytes = %lu\n”, ret);
//Output of the required bytes per sample.

DapiSpecialCommand - DapiSpecialSWFifoGetBytesPerSample
This command specifies how many bytes are required for writing to the D/A converter

DapiSpecialCommand-DapiSpecialSWFifoGetBytesPerSample

 

Description

This command specifies how many bytes are required for writing to the D/A converter.
Example: If 3 D/A channels are written to a 16 bit (2 byte) D/A converter, 3×2 bytes are required per sample. So the value 6 will be returned.

 

Definition

ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_GET_BYTES_PER_SAMPLE
fifo_instance = Specifies the instance of the software FIFO

 

Return value

Bytes required per sample

 

Programming example

unsigned long ret = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_GET_BYTES_PER_SAMPLE, fifo_instance, 0);
printf(“Required bytes = %lu\n”, ret);
//Output of the required bytes per sample.

DapiSpecialCommand - DapiSpecialSWFifoSetMode
This command sets the software FIFO mode

DapiSpecialCommand-DapiSpecialSWFifoSetMode

 

Description

This command sets the software FIFO mode. This command is not yet supported in the current firmware.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, par2);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_SET_MODE
fifo_instance = Specifies the instance of the software FIFO
par2 = Software FIFO Mode

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_SET_MODE, fifo_instance, 0);
//The software FIFO mode is set.

DapiSpecialCommand - DapiSpecialSWFifoGetMode
This command returns the previously set FIFO mode

DapiSpecialCommand-DapiSpecialSWFifoGetMode

 

Description

This command returns the previously set FIFO mode. Currently this mode is not yet supported in the firmware.

 

Definition

ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameters

cmd = DAPI_SPECIAL_SW_FIFO_GET_MODE
fifo_instance = Specifies the instance of the software FIFO

 

Return value

FIFO Software Mode

 

Programming example

unsigned long ret = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,
DAPI_SPECIAL_SW_FIFO_GET_MODE, fifo_instance, 0);
printf(“Mode = %lu\n”, ret);
//Get the previously set FIFO mode.

DapiSpecialCommand - DapiSpecialSWFifoGetStatus
This command can be used to retrieve status values

DapiSpecialCommand-DapiSpecialSWFifoGetStatus

 

Beschreibung

This command can be used to retrieve status values.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO, cmd, fifo_instance, 0);

 

Parameter

cmd = DAPI_SPECIAL_SW_FIFO_GET_STATUS
fifo_instance = Specifies the instance of the software FIFO

 

Return-Value

Description
(FIFO status generates a return value…)
Return value in hex
DAPI_SPECIAL_SW_FIFO_STATUS_IS_ACTIVE … when the output of the D/A converter is active 0x01
DAPI_SPECIAL_SW_FIFO_STATUS_IO_IS_ACTIVE … if the output of the FIFO I/O is active 0x02
DAPI_SPECIAL_SW_FIFO_STATUS_FIFO_OVERFLOW … if too much data is written into the FIFO 0x04
DAPI_SPECIAL_SW_FIFO_STATUS_FIFO_UNDERRUN … when the FIFO runs empty 0x08
DAPI_SPECIAL_SW_FIFO_STATUS_FIFO_OUT_OF_SYNC … if the FIFO communication within the modules is interrupted 0x10

Programming example

unsigned long ret;

ret = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_SW_FIFO,DAPI_SPECIAL_SW_FIFO_GET_STATUS, fifo_instance, 0);
if((ret & 0x01) != 0) {printf(“is_active”);}
if((ret & 0x02) != 0) {printf(“io_is_active”);}
if((ret & 0x04) != 0) {printf(“fifo_overflow”);}
if((ret & 0x08) != 0) {printf(“fifo_underrun”);}
if((ret & 0x10) != 0) {printf(“fifo_out_of_sync);}

DapiSpecialCommand - DapiSpecialCMDAD
This command controls the Software FIFO of a A/D converter.

DapiSpecialCommand-DapiSpecialCMDAD

 

Description

This command manages the control of the software FIFO of an A/D converter.

 

Definition

ULONG DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_AD, ULONG cmd, ULONG ch_range, ULONG par0);

 

Parameters

handle = This is the handle of an open module
ch_range = Indicates the number of the A/D converter module (see example or file delib.h)

 

Initialize FIFO

cmd=DAPI_SPECIAL_RO_AD_FIFO_INIT
par0=not defined

Activate FIFO
cmd=DAPI_SPECIAL_RO_AD_FIFO_ACTIVATE
par0=not defined

Deactivate FIFO
cmd=DAPI_SPECIAL_RO_AD_FIFO_DEACTIVATE
par0=not defined

Set FIFO interval
cmd=DAPI_SPECIAL_RO_AD_FIFO_SET_INTERVAL_MS
par0=interval [msec]

Set FIFO for an A/D converter channel
cmd=DAPI_SPECIAL_RO_AD_FIFO_SET_CHANNEL
par0=16 bit value for A/D channels that are written to the FIFO. Each bit stands for one channel (Bit0 -> AD0, Bit1 -> AD1, … Bit15 -> AD15).
If the bit is set, the corresponding A/D channel is active.

Request FIFO status
cmd=DAPI_SPECIAL_RO_AD_FIFO_GET_STATUS
par0=not defined

 

Return-Value

cmd=DAPI_SPECIAL_RO_AD_FIFO_INIT
no return value

cmd=DAPI_SPECIAL_RO_AD_FIFO_ACTIVATE
no return value

cmd=DAPI_SPECIAL_RO_AD_FIFO_DEACTIVATE
no return value

cmd=DAPI_SPECIAL_RO_AD_FIFO_SET_INTERVAL_MS
no return value

cmd=DAPI_SPECIAL_RO_AD_FIFO_SET_CHANNEL
no return value

cmd=DAPI_SPECIAL_RO_AD_FIFO_GET_STATUS
return=current FIFO status

Value [hex] Meaning Explanation 0x80 RO_FIFO_STATUS_MASK_MEASURE_ENABLED FIFO is active 0x40 RO_FIFO_STATUS_MASK_TEST_DATA
0x20 RO_FIFO_STATUS_MASK_OVERFLOW FIFO Buffer is full 0x10 RO_FIFO_STATUS_MASK_UNDERRUN
0x08 RO_FIFO_STATUS_FULL_256_BYTE 256 Byte data available 0x04 RO_FIFO_STATUS_FULL_64_BYTE 64 Byte data available 0x02 RO_FIFO_STATUS_FULL_16_BYTE 16 Byte data available 0x01 RO_FIFO_STATUS_FULL_1_BYTE 1 Byte data available

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_AD, DAPI_SPECIAL_RO_AD_FIFO_DEACTIVATE, DAPI_SPECIAL_AD_CH0_CH15, 0);
// deactivates the current AD-FIFO recording for AD module0 (channel 0 to 15)

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_AD, DAPI_SPECIAL_RO_AD_FIFO_INIT, DAPI_SPECIAL_AD_CH0_CH15, 0);
// initializing a new AD-FIFO recording for AD module 0 (channel 0 to 15)

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_AD, DAPI_SPECIAL_RO_AD_FIFO_SET_INTERVAL_MS, DAPI_SPECIAL_AD_CH0_CH15, 100);
// Set the AD-FIFO interval for recording to 100 ms for AD module 0 (channel 0 to 15).

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_AD, DAPI_SPECIAL_RO_AD_FIFO_SET_CHANNEL, DAPI_SPECIAL_AD_CH0_CH15, 0x1051);
// set the A/D channels to be recorded for AD module 0 (channel 0 to 15)
// 0x1051 [hex] = 0001 0000 0101 0001 0001 [bin]
// the following channels are recorded: AD0, AD4, AD6 and AD12

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_AD, DAPI_SPECIAL_RO_AD_FIFO_ACTIVATE, DAPI_SPECIAL_AD_CH0_CH15, 0);
// starts / activates the recording

status = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_AD, DAPI_SPECIAL_RO_AD_FIFO_GET_STATUS, DAPI_SPECIAL_AD_CH0_CH15, 0);
// get the current AD-FIFO status

DapiWriteFifo
This command writes data records into the software FIFO

DapiWriteFifo

 

Description

This command writes data records into the software FIFO.

 

Definition

DapiWriteFifo(ULONG handle, ULONG fifo_instance, ULONG type, UCHAR * buffer, ULONG buffer_length);

 

Parameters

handle=This is the handle of an open module
fifo_instance=Gives the instance of the software FIFO
type=Gives the FIFO type
buffer=Buffer for the record to be sent
buffer_length=Length of the buffer

 

Programming example

DapiWriteFifo(handle, fifo_instance, 0, buff, pos);
//Writes the data set to the software FIFO.

DapiReadFifo
This command reads the Software-FIFO of the RO-Modules

DapiReadFifo

 

Description

This command reads the software FIFO. The data sets read out are deleted from the module’s software FIFO after reading.

 

Definition

ULONG DapiReadFifo(ULONG handle, ULONG type, UCHAR * buffer, ULONG buffer_length);

 

Parameters

handle=This is the handle of an open module
fifo_instance=Gives the instance of the software FIFO
type=Gives the FIFO type
buffer=Buffer for the record to be received
buffer_length=Length of the buffer

 

Return-Value

Length of the read FIFO data records

 

Structure of a FIFO data record (example with 2 active AD channels, AD0 and AD4)

Byte || Meaning || Value [hex]

0 RO_FIFO_ID_START 0xf0

1 FIFO type
2 Time stamp (Bit0..Bit7)
3 Time stamp (Bit8..Bit15)
4 Active A/D channels (Bit0..Bit7) 0x11

5 Active A/D channels (Bit8..Bit15) 0x00

6 A/D value channel 0 (Bit0..Bit7)
7 A/D value channel 0 (Bit8..Bit15)
8 A/D value channel 4 (Bit0..Bit7)
9 A/D value channel 4 (Bit8..Bit15)
10 RO_FIFO_ID_END 0xf1

FIFO data set = 7 bytes ID + (2 x number of active A/D channels) bytes data

 

RO_FIFO_ID_START

Signals the beginning of a new FIFO data record. The RO_FIFO_ID_START always has the value 0xf0 [hex].

 

FIFO type

Specifies the FIFO type (e.g. RO_FIFO_ID_TYPE_AD16M0 for A/D-FIFO)

 

Time stamp

Specifies the 16 bit time stamp of the current record. The time reference here is the time of activation of the FIFO.
If the time stamp overflows, it is reset to 0.

 

Active A/D channels

Specifies a 16 bit value for the currently active A/D channels. Each bit represents one channel (Bit0 -> AD0, Bit1 -> AD1, … Bit15 -> AD15).
If the bit is set, the corresponding A/D channel is active

RO_FIFO_ID_END
Signals the end of a FIFO data record. The RO_FIFO_ID_END always has the value 0xf1 [hex].

 

Comment

This command is only supported by our RO-ETH series modules.
Please note that the software FIFO must be activated or initialized with the command “DapiSpecialCMDAD”.

 

Programming example

bytes_received = DapiReadFifo(handle, DAPI_FIFO_TYPE_READ_AD_FIFO, buffer, sizeof(buffer));
// Reads the Software FIFO

CNT48 functions

DapiCnt48ModeSet
This command sets the count mode for a single input channel.

DapiCnt48ModeSet

 

Description

This command sets a counting mode (optionally also sub mode) and input filter for a specific input counter channel.

 

Definition

void DapiCnt48ModeSet(ULONG handle, ULONG ch, ULONG mode);

 

Parameters

handle=This is the handle of an open module
ch=number of the input counter channel whose mode is to be set (0, 1, 2, 3, .. )
mode= Specifies the mode

 

Possible values for mode

mode=DAPI_CNT48_MODE_COUNT_RISING_EDGE | DAPI_CNT48_SUBMODE_NO_RESET
In this mode, counting is performed on the rising edge.

 

mode=DAPI_CNT48_MODE_COUNT_RISING_EDGE | DAPI_CNT48_SUBMODE_RESET_WITH_READ
In this mode, counting is performed on the rising edge. In addition, the counter is reset with every read operation.

 

mode=DAPI_CNT48_MODE_COUNT_RISING_EDGE | DAPI_CNT48_SUBMODE_RESET_ON_CH_7
In this mode, counting is performed on the rising edge. In addition, the counter can be reset via an external signal (last channel of the module = 1).

 

mode=DAPI_CNT48_MODE_COUNT_RISING_EDGE | DAPI_CNT48_SUBMODE_LATCH_COMMON
With the command “DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_LATCH_GROUP8, 0, 0)” all 8 counter values of the input counters are written into a latch simultaneously. This mode can then be used to read the latched counter reading.

 

mode=DAPI_CNT48_MODE_T
This mode is used to measure the period T. A 100 MHz counter serves as a basis for this.

 

mode=DAPI_CNT48_MODE_FREQUENCY
In this mode the number of rising edges within one second (= frequency) can be measured.

 

mode=DAPI_CNT48_MODE_PWM
This mode is used to measure the “high” and “low” time of a signal. The ratio can then be determined (PWM).

 

Additionally, all input counters can be combined with an input filter (with an or combination). The following input filters are available for this:

 

DAPI_CNT48_FILTER_20ns
DAPI_CNT48_FILTER_100ns
DAPI_CNT48_FILTER_250ns
DAPI_CNT48_FILTER_500ns
DAPI_CNT48_FILTER_1us
DAPI_CNT48_FILTER_2_5us
DAPI_CNT48_FILTER_5us
DAPI_CNT48_FILTER_10us
DAPI_CNT48_FILTER_25us
DAPI_CNT48_FILTER_50us
DAPI_CNT48_FILTER_100us
DAPI_CNT48_FILTER_250us
DAPI_CNT48_FILTER_500us
DAPI_CNT48_FILTER_1ms
DAPI_CNT48_FILTER_2_5ms
DAPI_CNT48_FILTER_5ms

 

Comment

This command is only supported by our module RO-CNT8.

 

Programming example

DapiCnt48ModeSet(handle, 0, DAPI_CNT48_MODE_COUNT_RISING_EDGE | DAPI_CNT48_SUBMODE_RESET_WITH_READ | DAPI_CNT48_FILTER_20ns);
//input counter channel 0 counts all pulses <= 20ns on rising edge. In addition, the counter is reset after a query.
DapiCnt48ModeSet(handle, 1, DAPI_CNT48_MODE_COUNT_RISING_EDGE | DAPI_CNT48_SUBMODE_RESET_ON_CH_7 | DAPI_CNT48_FILTER_500us);
//input counter channel 1 counts all pulses <= 500us on rising edge. This counter can be reset with an external signal (ch7 = 1).
DapiCnt48ModeSet(handle, 2, DAPI_CNT48_MODE_PWM | DAPI_CNT48_FILTER_5ms);
//input counter channel 2 measures all low-/high times <= 5ms. The ratio is then determined (PWM).

DapiCnt48ModeGet
This command returns the count mode of a single input channel.

DapiCnt48ModeGet

 

Description

This instruction reads back the count mode of a specific input counter channel.

 

Definition

ULONG DapiCnt48ModeGet(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch=number of the input counter channel whose mode is to be output (0, 1, 2, 3, .. )

 

Return-Value

Counting mode of the input counter channel.
(More information / description of the bits -> see delib.h or manual “RO register assignment”)

 

Comment

This command is only supported by our module RO-CNT8.

 

Programming example

value = DapiCnt48ModeGet(handle, 0)
//G Returns the count mode of input counter channel 0
value = DapiCnt48ModeGet(handle, 3)
//G Returns the counting mode of input counter channel 3

DapiCnt48CounterGet32
This command reads the first 32 bits of a 48 bit input counter.

DapiCnt48CounterGet32

 

Description

This command reads the first 32 bits of a 48-bit input counter.

 

Definition

ULONG DapiCnt48CounterGet32(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the input counter channel to be read (0, 1, 2, 3, .. )

 

Return-Value

Output of the counter value.

 

Comment

This command is only supported by our modules RO-CNT8 and RO-CNT/IGR.

 

Programming example

value = DapiCnt48CounterGet32(handle, 0);
//outputs the value of input counter channel 0
value = DapiCnt48CounterGet32(handle, 3);
//outputs the value of input counter channel 3

DapiCnt48CounterGet48
This command reads a 48 bit counter of an input counter.

DapiCnt48CounterGet48

 

Description

Dieser Befehl liest einen 48 Bit Zähler eines Eingangszählerkanals.

 

Definition

ULONGLONG DapiCnt48CounterGet48(ULONG handle, ULONG ch);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the input counter channel to be read (0, 1, 2, 3, .. )

 

Return-Wert

Output of the counter value.

 

Comment

This command is only supported by our modules RO-CNT8 and RO-CNT/IGR.

 

Programming example

value = DapiCnt48CounterGet48(handle, 0);
//outputs the value of input counter channel 0
value = DapiCnt48CounterGet48(handle, 3);
//outputs the value of input counter channel 3

DapiSpecialCommand - DapiSpecialDIFilterValueSet
This command sets a filter [ms], in which time interval digital input channels are sampled

DapiSpecialCommand – Dapi_Special_DI_Filter_Value_Set

 

Description

This command sets a filter [ms], in which time interval digital input channels are sampled.

 

Definition

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI, DAPI_SPECIAL_DI_FILTER_VALUE_SET, ULONG time_ms, 0);

 

Parameters

handle=This is the handle of an opened module.
time_ms=Time interval [ms] by which digital input channels are sampled.

 

Remarks

This command only supports pulse times between 5ms and 255ms.
If no time is set, the default value is 100ms.

 

This command is not supported by our modules with Ethernet interface.

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI, DAPI_SPECIAL_DI_FILTER_VALUE_SET, 5, 0);
// Sets the time interval to 5ms
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI, DAPI_SPECIAL_DI_FILTER_VALUE_SET, 150, 0);
// Sets the time interval to 150ms

DapiSpecialCommand - DapiSpecialDIFilterValueGet
This command returns the previously set value of the time interval for sampling the digital input channels in [ms]

DapiSpecialCommand – Dapi_Special_DI_Filter_Value_Get

 

Description

This command returns the previously set value of the time interval for sampling the digital input channels in [ms].

 

Definition

ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI, DAPI_SPECIAL_DI_FILTER_VALUE_GET, 0, 0);

 

Parameters

handle=This is the handle of an open module

 

Return-Value

Time [ms]

 

Remarks

This command is not supported by our modules with Ethernet interface.

 

Programming example

value = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI, DAPI_SPECIAL_DI_FILTER_VALUE_GET, 0, 0);
//Returns the time interval for sampling the digital input channels

DapiSpecialCommand - Dapi_Special_DI_FF_Filter_Value_Set
This command sets a filter [ms], in which time interval the input flip-flops and the input counters are polled.

DapiSpecialCommand – Dapi_Special_DI_FF_Filter_Value_Set

 

Description

This command sets a filter [ms], in which time interval the input flip-flops and the input counters are polled.

 

Definition

void DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI, DAPI_SPECIAL_DI_FF_FILTER_VALUE_SET, ULONG time_ms, 0);

 

Parameters

handle=This is the handle of an open module
time_ms=Time interval [ms] by scanning digital input channels.

 

Return-Value

None.

 

Comment

This command only supports pulse times between 5ms and 255ms.
If no time is set, the default value is 100ms.

 

This command is not supported by our modules with Ethernet interface.

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI, DAPI_SPECIAL_DI_FF_FILTER_VALUE_SET, 5, 0);
// Sets the time interval to 5ms
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI,
DAPI_SPECIAL_DI_FF_FILTER_VALUE_SET, 150, 0);
// Sets the time interval to 150ms

DapiSpecialCommand - Dapi_Special_DI_FF_Filter_Value_Get
This command returns the predefined value of the time interval for sampling the input flip-flops and the input counters in [ms].

DapiSpecialCommand – Dapi_Special_DI_FF_Filter_Value_Get

 

Description

This command returns the predefined value of the time interval for sampling the input flip-flops and the input counters in [ms].

 

Definition

ULONG DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI, DAPI_SPECIAL_DI_FF_FILTER_VALUE_GET, 0, 0);

 

Parameters

handle=This is the handle of an open module

 

Return-Value

Time [ms]

 

Comment

This command is not supported by our modules with Ethernet interface.

 

Programming example

value = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_DI, DAPI_SPECIAL_DI_FF_FILTER_VALUE_GET, 0, 0);
// Returns the time interval for scanning the digital input channels.

DapiSpecialCommand - DapiSpecialCNT48LatchGroup8
This command saves the counter values of 8 inputcounters simultaneously into a temporary storage (latch). So, after that, the counter values of the latch can be read successively. Here, the speciality is, that it is possible to "freeze" the counter simultaneously and the frozen counter (latch) can be read one by one.

DapiSpecialCommand – DapiSpecialCNT48LatchGroup8

 

Description

This instruction stores the counter readings of 8 input counters simultaneously in a latch.
Thus, all counter readings of the latch can be read out one after the other.
A special feature is that a simultaneous “freezing” of the counter readings is possible and the frozen readings (latch) can then be read out (slowly) one after the other.

 

Definition

void DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_LATCH_GROUP8, ULONG ch, 0)

 

Parameters

handle=This is the handle of an open module
ch=Specifies the number of the input counter from which the counter status of 8 input counters are latched (0, 8, 16, …)

 

Comment

This command is only supported by our module RO-CNT8.

Please regard that only the counter readings of the input counters are latched for which the mode

“DAPI_CNT48_SUBMODE_LATCH_COMMON” was set. (-> DapiCnt48ModeSet)

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_LATCH_GROUP8, 0, 0)
// Counter values of the input counters 0-7 are latched
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_LATCH_GROUP8, 8, 0)
// Counter values of the input counters 8-15 are latched

DapiSpecialCommand - DapiSpecialCNT48ResetGroup8
This command resets the counter values of 8 inputcounter simultaneously.

DapiSpecialCommand – DapiSpecialCNT48ResetGroup8

 

Description

This command simultaneously resets the counts of 8 input counters.

 

Definition

void DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_RESET_GROUP8, ULONG ch, 0)

 

Parameters

handle=This is the handle of an open module
ch=Specifies the number of the input counter from which the counter status of 8 input counters are reset (0, 8, 16, …)

 

Comment

This command is only supported by our module RO-CNT8.

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_RESET_GROUP8, 0, 0)
// Counter values of the input counters 0-7 are reset
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_RESET_GROUP8, 8, 0)
// Counter values of the input counters 8-15 are reset

DapiSpecialCommand - DapiSpecialCNT48ResetSingle
This commands resets the counter value of a single inputcounter.

DapiSpecialCommand – DapiSpecialCNT48ResetSingle

 

Description

This command resets the count of a single input counter.

 

Definition

void DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_RESET_SINGLE, ULONG ch, 0)

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the input counter whose counter value is to be reset (0, 1, 2, ..)

 

Comment

This command is only supported by our module RO-CNT8.

 

Programming example

DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_RESET_SINGLE, 0, 0)
// Counter reading of input counter 0 is reset
DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_RESET_SINGLE, 1, 0)
// Counter reading of input counter 1 is reset

DapiSpecialCommand - DapiSpecialCNT48DIGet1
This command reads the input state (0/1) of a single inputcounterchannel.

DapiSpecialCommand – DapiSpecialCNT48DIGet1

 

Description

This command reads the input state (0/1) of a digital input counter channel.

 

Definition

ULONG DapiSpecialCommand(ULONG handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_DI_GET1, ULONG ch, 0);

 

Parameters

handle=This is the handle of an open module
ch= Specifies the number of the input counter channel whose input state is to be read (0, 1, 2, 3, .. )

 

Return-Value

Status of the input counter (0/1)

 

Comment

This command is only supported by our module RO-CNT8.

 

Programming example

value = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_DI_GET1, 0, 0)
// Reads input status of input counter channel 1
value = DapiSpecialCommand(handle, DAPI_SPECIAL_CMD_CNT48, DAPI_SPECIAL_CNT48_DI_GET1, 1, 0)
// Reads input status of input counter channel 2

Puls-Gen-Functions

DapiPulseGenSet
This command generates a certain number of pulses with predetermined low and high times.

DapiPulseGenSet

 

Description

This command generates a certain number of pulses with preset low and high times.

 

Definition

void DapiPulseGenSet(ULONG handle, ULONG ch, ULONG mode, ULONG par0, ULONG par1, ULONG par2);

 

Parameter

handle=This is the handle of an open module
ch= Specifies the number of the output to be set (0, 1, 2, .. )
mode=Mode with which pulses are generated (must always be 0).
par0=Number of pulses to be generated (par0=0 -> infinite number of pulses)
par1=Low time of the pulse ( t[ns] / 10 – 1)
par2=High time of the pulse ( t[ns] / 10 – 1)

 

Example for setting the low/high time (Par1/Par2)

500ns -> 500 / 10 – 1 = 49(dec)
7us -> 7.000 / 10 – 1 = 699(dec)
2,5ms -> 2.500.000 / 10 – 1 = 249.999(dec)

 

Return-Value

None

 

Programming example

DapiPulseGenSet(handle, 0, 0, 10, 29, 69);
// generates 10 pulses at pulse generator output 0 with a low time of 300ns and a high time of 700ns.
DapiPulseGenSet(handle, 3, 0, 100, 7999, 9999);
// generates 100 pulses at pulse generator output 3 with a low time of 80us and a high time of 100us.
DapiPulseGenSet(handle, 10, 0, 0, 249999, 299999);
// generates infinitely many pulses at pulse generator output 10 with a low time of 2.5ms and a high time of 3ms.

Register functions

DapiWriteByte
This command performs a direct register write command to the module.

DapiWriteByte

 

Description

This command executes a direct register write command to the module.

 

Definition

void DapiWriteByte(ULONG handle, ULONG adress, ULONG value);

 

Parameters

handle=This is the handle of an open module
adress=address to be accessed
value= Specifies the data value that is written (8 bit)

 

Return-Value

None

 

Comment

This should only be used by experienced programmers. This allows direct access to all available registers.

DapiWriteWord
This command performs a direct register write command to the module.

DapiWriteWord

 

Description

This command executes a direct register write command to the module.

 

Definition

void DapiWriteWord(ULONG handle, ULONG adress, ULONG value);

 

Parameters

handle=This is the handle of an open module
adress=address to be accessed
value= Specifies the data value that is written (16 bit)

 

Return-Value

None

 

Comment

This should only be used by experienced programmers. This allows direct access to all available registers.

DapiWriteLong
This command performs a direct register write command to the module.

DapiWriteLong

 

Description

This command executes a direct register write command to the module.

 

Definition

void DapiWriteLong(ULONG handle, ULONG adress, ULONG value);

 

Parameters

handle=This is the handle of an open module
adress=address to be accessed
value= Specifies the data value that is written (32 bit)

 

Return-Value

None

 

Comment

This should only be used by experienced programmers. This allows direct access to all available registers.

DapiWriteLongLong
This command performs a direct register write command to the module.

DapiWriteLongLong

 

Description

This command executes a direct register write command to the module.

 

Definition

void DapiWriteLongLong(ULONG handle, ULONG adress, ULONGLONG value);

 

Parameters

handle=This is the handle of an open module
adress=address to be accessed
value= Specifies the data value that is written (64 bit)

 

Return-Value

None

 

Comment

This should only be used by experienced programmers. This allows direct access to all available registers.

DapiReadByte
This command performs a direct register read command to the module.

DapiReadByte

 

Description

This command executes a direct register read command to the module.

 

Definition

ULONG DapiReadByte(ULONG handle, ULONG adress);

 

Parameters

handle=This is the handle of an open module
adress=address to be accessed

 

Return-Value

Content of the register to be read (8 bit)

 

Comment

This should only be used by experienced programmers. This allows direct access to all available registers.

DapiReadWord
This command performs a direct register read command to the module.

DapiReadWord

 

Description

This command executes a direct register read command to the module.

 

Definition

ULONG DapiReadWord(ULONG handle, ULONG adress);

 

Parameters

handle=This is the handle of an open module
adress=address to be accessed

 

Return-Value

Content of the register to be read (16 bit)

 

Comment

This should only be used by experienced programmers. This allows direct access to all available registers.

DapiReadLong
This command performs a direct register read command to the module.

DapiReadLong

 

Description

This command executes a direct register read command to the module.

 

Definition

ULONG DapiReadLong(ULONG handle, ULONG adress);

 

Parameters

handle=This is the handle of an open module
adress=address to be accessed

 

Return-Value

Content of the register to be read (32 bit)

 

Comment

This should only be used by experienced programmers. This allows direct access to all available registers.

DapiReadLongLong
This command performs a direct register read command to the module.

DapiReadLongLong

 

Description

This command executes a direct register read command to the module.

 

Definition

ULONGLONG DapiReadLongLong(ULONG handle, ULONG adress);

 

Parameters

handle=This is the handle of an open module
adress=address to be accessed

 

Return-Value

Content of the register to be read (64 bit)

 

Comment

This should only be used by experienced programmers. This allows direct access to all available registers.