DioDmSetBuffer


Function

Sets the data buffer used for sampling/generating.

Format

Ret = DioDmSetBuffer ( Id , Direction , Buffer , Length , IsRing )

Parameters

Id [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from DioInit.

Direction [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Set the transfer direction.

Definition

Value

[Dec]

Description

DIODM_DIR_IN

1

Input

DIODM_DIR_OUT

2

Output

Buffer [ VB.NET: IntPtr ] [ C, C++: unsigned long * ] [ C#: IntPtr ] [ Python: ctypes.POINTER(ctypes.c_ulong) ]
Specify the base address of the buffer.

Length [ VB.NET: Integer ] [ C, C++: unsigned long ] [ C#: uint ] [ Python: ctypes.c_ulong ]
Specify the number of the data.

Device Type

Available range

DIO-32DM3-PE

Length can be set from 1 to 536870912 (for 2GByte).

 

These devices implement bus master transfers with a 64-bit bus width.

Bus master transfer with 64-bit bus width has no buffer size limit depending on the OS used.

PIO-32DM(PCI)
DIO-32DM-PE
DIO-32DM2-PE

These devices implement bus master transfers with a 32-bit bus width.

Bus master transfers with a 32-bit bus width are subjected to buffer size restrictions depending on the OS used.

The hardware is designed to enable bus master transfers of up to 64MBytes.

However, Length cannot be set up to 16777216 (64MBytes) due to OS restrictions.

Please note. The details are as follows.

OS used

Range of settings

Windows 10 Version 1703 or later (including Windows 11)

Length can be set 1 to 524288 (for 2MBytes).

Windows 10 Version 1607 or earlier

Length can be set 1 to 262144 (for 1MByte).

 

*Depending on how the physical address space is mapped, it may not be possible to set the bus master buffer size up to the maximum area.

IsRing [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Set whether use the buffer repeatedly.

Definition

Value

[Dec]

Description

DIODM_WRITE_ONCE

0

Transfer once

DIODM_WRITE_RING

1

Transfer infinitely

Return Value

Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]

Definition

Value

[Dec]

Description

DIO_ERR_SUCCESS

0

Normal completed.

DIO_ERR_SYS_RECOVERED_FROM_STANDBY

7

Execute DioResetDevice function because the device has recovered from standby mode.

DIO_ERR_DLL_INVALID_ID

10001

Invalid ID specified.

DIO_ERR_DLL_CALL_DRIVER

10002

Not call the driver (Failure on DEVICE I/O CONTROL).

DIO_ERR_DLL_BUFF_ADDRESS

10100

Invalid data buffer address.

DIO_ERR_SYS_NOT_SUPPORTED

20001

This board couldn't use this function.

DIO_ERR_SYS_IODIRECTION

20500

Direction value is out of range.

DIO_ERR_DM_BUFFER

21100

Buffer was too large and has not secured.

DIO_ERR_DM_LOCK_MEMORY

21101

Memory has not been locked.

DIO_ERR_DM_SEQUENCE

21103

Procedure error of execution.

The others (See also: Details of Error Code)

Initial Value

None

Remarks

It is necessary to set the buffer first whenever you want to start the transfer.

Depending on how the buffer area maps to physical address space, maximum area maybe cannot be set.

When using the DIO-32DM3-PE, if buffer size is set to less than 2KByte and infinite transfer is performed, transfer rate will be reduced to hardware specifications.

An execution procedure error might occur by calling this function during sampling/generating. It is necessary to call this function after confirming that the sampling/generating has completed.

Example

Sets that execute infinite transfer on a buffer of 10000 data for input transfer.

VB.NET

Please refer to [Note of Using Visual Basic .NET].

 

C, C++

long Ret;
unsigned long Buffer[10000];
Ret = DioDmSetBuffer ( Id , DIODM_DIR_IN , &Buffer[0] , 10000 , DIODM_WRITE_RING );
 

C#

Please refer to [Note of Using Visual C#].

 

Python

Ret = ctypes.c_long()
BufferType = ctypes.c_ulong * 10000
Buffer = BufferType()
Ret.value = cdio.DioDmSetBuffer ( Id , cdio.DIODM_DIR_IN , Buffer , 10000 , cdio.DIODM_WRITE_RING )
 

See Also

DioDmTransferStart