Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

Debounce DI signal on crio

Python with nidaqmx

cRio with NI9411

External device: quadrature encoder wheel

 

Hi,

 

A rookie question here.  I am using python to read the encoder lines from my wheel encoder.

This one: https://cdn.automationdirect.com/static/specs/encoderhd.pdf

 

Anyway, the signals are a bit noisy, as they show changes even when the wheel is motionless, but I seem to get decent readings when the encoder is turned fairly quickly.

 

Can I debounce these readings?  I looked at the filtering like so, and it did not have the effect I was looking for, so perhaps I am on the wrong path here:

 

channelA = task.di_channels.add_di_chan("Mod3/port0/line0")
channelB = task.di_channels.add_di_chan("Mod3/port0/line1")
channelZ = task.di_channels.add_di_chan("Mod3/port0/line2")

channelA.di_dig_fltr_min_pulse_width = 1
channelB.di_dig_fltr_min_pulse_width = 1
channelZ.di_dig_fltr_min_pulse_width = 1
channelA.di_dig_fltr_enable
channelB.di_dig_fltr_enable
channelZ.di_dig_fltr_enable

 

 

0 Kudos
Message 1 of 2
(821 Views)

I got a bit further, but can't get past this error using this code:

 

channelA = task.di_channels.add_di_chan("Mod3/port0/line0")
channelB = task.di_channels.add_di_chan("Mod3/port0/line1")
channelZ = task.di_channels.add_di_chan("Mod3/port0/line2")

channelA.di_dig_fltr_min_pulse_width = 1
channelB.di_dig_fltr_min_pulse_width = 1
channelZ.di_dig_fltr_min_pulse_width = 1
channelA.di_dig_fltr_enable = True
channelB.di_dig_fltr_enable = True
channelZ.di_dig_fltr_enable = True

 

raise DaqError(error_buffer.value.decode("utf-8"), error_code)
nidaqmx.errors.DaqError: Property specified is not supported in conjunction with a conflicting property.
Property: DAQmx_SampTimingType
Value: DAQmx_Val_OnDemand
Property: DAQmx_DI_DigFltr_Enable
Value: 1

0 Kudos
Message 2 of 2
(791 Views)