Last edited · 6 revisions   


Digital Input Options

For OnStepX digital sense inputs you can specify the following ON state options in addition to HIGH and LOW:

  • Digitally filter electrical noise, optionally add:
    • |HYST(n) Where n=0..1023 signal stability time in ms.
      • For example so the sensed state doesn't change unless OnStepX sees a stable signal for 100ms:
        #define PARK_SENSE LOW|HYST(100)
  • Analog capable sense inputs also allow using:
    • |THLD(n) Where n=1..1023 (ADU) for Analog threshold.
    • |HYST(n) Where n=0..1023 (ADU) for +/- Hysteresis range.
      • An ADU is an Analog Digital Unit and OnStepX works in 10 bit mode so the range of values (counts) is 0 to 1023.  They represent the voltage range from 0V to Vcc (the voltage the microcontroller operates at) which is 3.3V usually.  The examples below assume Vcc = 3.3V.
      • The sense logic still works as being ON or OFF but this allows measuring the voltage on the pin and performing a check against THLD(n) to make the determination if its higher (HIGH) or lower (LOW,) except it can ignore the (optional) HYST(n) specified range.
      • For example so the sensed state is OFF below 1.65V and ON above 1.65V:
        #define PARK_SENSE HIGH|THLD(512)
      • For example so the sensed state is ON below 0.83V and OFF above 2.48V, in-between the sensed state retains its last value:
        #define PARK_SENSE LOW|THLD(512)|HYST(256)