DioDmSetBuff


Function

Sets data buffer to be used for sampling and generating.

Format

Ret = DioDmSetBuff ( Id , Dir , Buff , Len , IsRing )

Parameters

Id [C:short] [Python: ctypes.c_short]
Specifies the device ID retrieved from DioInit.

Dir [C:unsigned long] [Python: ctypes.c_ulong]
Specify transfer direction.

Definition

Value

[Dec]

Description

DIODM_DIR_IN

1

Input

DIODM_DIR_OUT

2

Output

Buff [C:unsigned long *] [Python: ctypes.POINTER(ctypes.c_ulong)]
Specify the starting address of the buffer.
When used on 64bit OS, please declare the buffer as unsigned int and cast the starting address of the buffer to unsigned long *.

Len [C:unsigned long] [Python: ctypes.c_ulong]
Specify data number.

Device Type

OS

Available range

DIO-32DM3-PE

64Bit OS

Len (the number of the data) * 4Byte(data unit) <= 2GByte

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

32Bit OS

Len (the number of the data) * 4Byte(data unit) <= 64MByte

IsRing [C:unsigned long] [Python: ctypes.c_ulong]
Set whether or not the buffer is repeatedly used.

Definition

Value

[Dec]

Description

DIODM_WRITE_ONCE

1

Single transfer

DIODM_WRITE_RING

2

Unlimited transfer

Return Value

Ret[C:long] [Python: ctypes.c_long]

Definition

Value

[Dec]

Description

DIO_ERR_SUCCESS

0

Normal complete

DIO_ERR_DLL_INVALID_ID

10001

Invalid ID is specified.

DIO_ERR_DLL_CALL_DRIVER

10002

Driver cannot be called (failed in ioctl).

DIO_ERR_DLL_BUFF_ADDRESS

10100

Invalid data buffer address.

DIO_ERR_SYS_MEMORY

20000

Failed in memory.

DIO_ERR_SYS_DIRECTION

50000

I/O direction is outside of the setting range.

DIO_ERR_DM_BUFFER

50100

Buffer was too large and has not secured.

DIO_ERR_DM_LOCK_MEMORY

50101

Memory could not be locked.

DIO_ERR_DM_SEQUENCE

50103

Procedure error of execution.

The other errors: (See also: Error code details)

Initial Value

None

Remarks

Buffers must be set every time before starting 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.

Even when I/O direction is set to PIO_1616, the output data is set from the 0th bit of the buffer as with PO_32. There is no need to shift left by 16 bits.

Example

C

Ret = DioDmSetBuff( Id , DIODM_DIR_IN , Buff , 1000 , DIODM_WRITE_ONCE );
 

Python

Ret = cdio.DioDmSetBuff( Id , cdio.DIODM_DIR_IN , Buff , 1000 , cdio.DIODM_WRITE_ONCE )
 

See Also

None