DioSetPulseMeasurementSetting


Function

Sets the pulse measurement parameters for the specified channel.

Format

Ret = DioSetPulseMeasurementSetting ( Id , ChNo , ChNum , MeasurementTarget, PulsePeriod )

Parameters

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

ChNo [ VB.NET: Short ] [ C, C++: short * ] [ C#: out short ] [ Python: ctypes.POINTER(ctypes.c_short) ]
Specify the start address of the array that stores the channel numbers to set.

ChNum [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the number of channels specified in ChNo.

MeasurementTarget [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Specify the start address of the array that stores the pulse measurement time settings.

Definition

Value

[Dec]

Description

DIO_PULSE_MEASUREMENT_TARGET_OFF_TIME

0

Measure the OFF time

DIO_PULSE_MEASUREMENT_TARGET_ON_TIME

1

Measure the ON time

PulsePeriod [ VB.NET: UShort ] [ C, C++: unsigned short * ] [ C#: out ushort ] [ Python: ctypes.POINTER(ctypes.c_ushort) ]
Specify the start address of the array that stores the pulse measurement period settings.

Definition

[Dec]

Description

0

25nsec

1

50nsec

2

100nsec

3

200nsec

4

400nsec

5

800nsec

6

1.6usec

7

3.2usec

8

6.4usec

9

12.8usec

10

25.6usec

11

51.2usec

12

102.4usec

13

204.8usec

14

409.6usec

15

819.2usec

16

1.6384msec

17

3.268msec

18

6.5536msec

19

13.1072msec

20

26.2144msec

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_CH_NO

20105

Specify the start address of the array that stores the channel numbers to set.

DIO_ERR_SYS_CH_NUM

20106

Specify the number of channels specified in ChNo.

DIO_ERR_SYS_PULSE_MEASUREMENT_TARGET

20950

The pulse measurement time is out of range.

DIO_ERR_SYS_PULSE_MEASUREMENT_PERIOD

20951

The pulse measurement period is out of range.

DIO_ERR_SYS_PULSE_MEASUREMENT_RUNNING

20952

Function is not allowed to be called during the pulse measurement operation.

The others (See also: Details of Error Code)

Initial Value

MeasurementTarget = DIO_PULSE_MEASUREMENT_TARGET_OFF_TIME(0)
PulsePeriod = 25nsec (0)

Remarks

Sets the pulse measurement parameters for the specified channel.

This function cannot be executed during pulse measurement operation.

Example

Sets the pulse measurement time of channel 0 to “measure ON time” and the pulse measurement period to 100 nsec.

VB.NET

Dim Ret As Integer
Dim ChNo(0) As Short
Dim MeasurementTarget(0) As UShort
Dim PulsePeriod(0) As UShort

ChNo(0) = 0
MeasurementTarget(0) = DIO_PULSE_MEASUREMENT_TARGET_ON_TIME
PulsePeriod(0) = 2
Ret = DioSetPulseMeasurementSetting( Id , ChNo , 1 , MeasurementTarget , PulsePeriod )
 

C, C++

long Ret;
short ChNo[1]
unsigned short MeasurementTarget[1];
unsigned short PulsePeriod[1];

ChNo[0] = 0;
MeasurementTarget[0] = DIO_PULSE_MEASUREMENT_TARGET_ON_TIME;
PulsePeriod[0] = 2;
Ret = DioSetPulseMeasurementSetting( Id , &ChNo[0] , 1 , &MeasurementTarget[0] , &PulsePeriod[0] );
 

C#

int Ret;
short[] ChNo = new short[1];
ulong[] MeasurementTarget = new ulong[1];
ushort[] PulsePeriod = new ushort[1];

ChNo[0] = 0;
MeasurementTarget[0] = DIO_PULSE_MEASUREMENT_TARGET_ON_TIME;
PulsePeriod[0] = 2;
Ret = dio.SetPulseMeasurementSetting( Id , ref ChNo , 1 , out MeasurementTarget , out PulsePeriod );
 

Python

Ret = ctypes.c_long()
ChNoType = ctypes.c_short * 1
ChNo = ChNoType()
MeasurementTargetType = ctypes.c_ushort * 1
MeasurementTarget = MeasurementTargetType()
PulsePeriodType = ctypes.c_ushort * 1
PulsePeriod = PulsePeriodType()

ChNo[0] = 0
MeasurementTarget[0] = cdio.DIO_PULSE_MEASUREMENT_TARGET_ON_TIME
PulsePeriod[0] = 2
Ret.value = cdio.DioSetPulseMeasurementSetting( Id , ChNo , 1 , MeasurementTarget , PulsePeriod )
 

See Also

DioGetPulseMeasurementSetting