DioSetDigitalFilter


Function

Sets digital filter.

Format

Ret = DioSetDigitalFilter ( Id , FilterValue )

Parameters

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

FilterValue [ C: short ] [ Python: ctypes.c_short ]
Specifies the filter coefficient.
Selects the filter coefficient in the following list depending on the device type.

DIO-1616LN-USB
- It is a simple filter by software.
- The filter is invalid for interrupts.

Setting Value

[Dec]

Setting Time

0

Digital filter unused

1 to 11

Digital filter unused (Reserved)

12

512 [usec]

13

1024 [usec]

14

2.048 [msec]

15

4.096 [msec]

16

8.192 [msec]

17

16.384 [msec]

18

32.768 [msec]

19

65.536 [msec]

20

131.072 [msec]

CPSN-DI-08L, CPSN-DI-08BL

Setting Value

[Dec]

Setting Time

0

Digital filter unused

1

Digital filter used

DIO-1616LN-ETH, DIO-1616RYN-ETH, DIO-0404LY-WQ
- It is a simple filter by software.

Setting Value

[Dec]

Setting Time

0

Digital filter unused

1 to 16

Digital filter unused (Reserved)

17

16.384 [msec]

18

32.768 [msec]

19

65.536 [msec]

20

131.072 [msec]

CPS-DIO-0808L, CPS-DIO-0808BL, CPS-DIO-0808RL, CPS-DI-16L, CPS-DI-16RL

Setting Value

[Dec]

Setting Time

0

No operation

1

0.25 [usec]

2

0.5 [usec]

3

1 [usec]

4

2 [ usec]

5

4 [usec]

6

8 [usec]

7

16 [usec]

8

32 [usec]

9

64 [usec]

10

128 [usec]

11

256 [usec]

12

512 [usec]

13

1024 [usec]

14

2.048 [msec]

15

4.096 [msec]

16

8.192 [msec]

17

16.384 [msec]

18

32.768 [msec]

19

65.536 [msec]

20

131.072 [msec]

CPSN-DI-16BCL

Setting Value

[Dec]

Setting Time

0

Digital filter unused

1 to 1000

Setting Value [msec]

PIO H series: PIO-XX(XX)H, PI-XX(XX)H, PIO-16/16RY(PCI), DIO-XXXX-PE, DI-XX-PE
DIO-XXXXLX-USB

Setting Value

[Dec]

Setting Time

Setting Value

[Dec]

Setting Time

0

No filter

11

256[usec]

1

0.25[usec]

12

512[usec]

2

0.50[usec]

13

1.024[msec]

3

1.0[usec]

14

2.048[msec]

4

2.0[usec]

15

4.096[msec]

5

4.0[usec]

16

8.192[msec]

6

8.0[usec]

17

16.384[msec]

7

16[usec]

18

32.768[msec]

8

32[usec]

19

65.536[msec]

9

64[usec]

20

131.072[msec]

10

128[usec]

 

 

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_SYS_FILTER

20400

Filter time constant is outside of the specified range.

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

Initial Value

Filter coefficient is 0. Digital filter is invalid.
However, the initial value of CPSN-DI-16BCL depends on the setting in the Web browser.

Remarks

Digital filter is a hardware function that makes the input value not change when the input bit doesn't remain ON or OFF in a certain period of time.
By using digital filter, the invalid input signals produced by the noise and chattering could be cut.
After considering the length of the device's chattering connecting at the external and the length of valid signals and so on, you could select which digit of time should be specified to be the coefficient.
This function cannot be used with CPSN-DIO-08SL.

Example

C

Ret = DioSetDigitalFilter( Id , FilterValue );
 

Python

Ret = cdio.DioSetDigitalFilter( Id , FilterValue )
 

See Also

DioInpByte
DioInpBit
DioInpMultiByte
DioInpMultiBit
DioSetInterruptEvent