11-02-2021 06:12 PM
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
11-03-2021 12:24 AM
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