DioDmSetCountEvent


Function

Sets that the message of specified number transfer completion is notified.

Format

Ret = DioDmSetCountEvent ( Id , Direction , Count , hWnd )

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

Count [ VB.NET: Integer ] [ C, C++: unsigned long ] [ C#: uint ] [ Python: ctypes.c_ulong ]
Set that the message is notified at the interval of how many data are transferred.

Device Type

Available range

DIO-32DM3-PE

3 =< Count =< 536,870,912(20000000H)

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

1 =< Count =<16,777,215(FFFFFFH)

hWnd [ VB.NET: IntPtr ] [ C, C++: HWND ] [ C#: IntPtr ] [ Python: ctypes.wintypes.HANDLE ]
Specify the window handle to receive the message of specified number transfer completion.
The window handle can be retrieved by m_hWnd in VC.
Specify it to 0 when you want to use callback function but not window message.

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_SYS_NOT_SUPPORTED

20001

This board couldn't use this function.

DIO_ERR_SYS_IODIRECTION

20500

Direction value is out of range.

DIO_ERR_SYS_COUNT

21010

Data transmission number is outside the setting range.

The others (See also: Details of Error Code)

Initial Value

None

Remarks

By using this function, it is possible to notify the message of specified number transfer completion that is set by the callback function during sampling/generating. When the number specified by Count is too small according to the I/O period, the message may not be notified for that the speed is very high.

The message ID is defined with DIO_DMM_COUNT = 1360H. By specifying a window handle to hWnd, when the sampling/generating completed, the DIO_DMM_COUNT message is posted to the specified window handle through the PostMessage function. The parameters of the message are wParam and lParam containing the following information respectively.
LOWORD(wParam)=ID retrieved from DioInit
LOWORD(lParam)=Transfer direction (DIODM_DIR_IN or DIODM_DIR_OUT)
* HIWORD indicates the high-order word. LOWORD indicates the low-order word.
For details about message handling, please refer to the sample programs of each language.

Example

Sets that the message of specified number transfer completion is notified for input transfer. The number of data to be transferred is 10000.

VB.NET

Dim Ret As Integer
Ret = DioDmSetCountEvent ( Id , DIODM_DIR_IN , 10000 , Handle )
 

C, C++

long Ret;
Ret = DioDmSetCountEvent ( Id , DIODM_DIR_IN , 10000 , m_hWnd );
 

C#

int Ret;
Ret = dio.DmSetCountEvent ( Id , (short)CdioConst.DIODM_DIR_IN , 10000 , Handle );
 

Python

Ret = ctypes.c_long()
handle = ctypes.windll.user32.FindWindowW(0, "Interrupt")
Ret.value = cdio.DioDmSetCountEvent ( Id , cdio.DIODM_DIR_IN , 10000 , handle )
 

See Also

DioDmTransferStart DioSetCountCallBackProc