14 Replies Latest reply on Sep 17, 2020 11:02 AM by JoBr_1593366

    Simple way to compare 1 input against multiple voltage thresholds?

    JoBr_1593366

      I know I can do it in software with an ADC, etc. but is there a way to do it that produces hardware outputs?

       

      For example, I tried using the Scanning Comparator, with the input voltage connected to all terminals, using "Internal VDAC" with "per channel" voltage thresholds.  Theoretically it would then continually scan the input vs the 3 thresholds and output 3 hardware logic signals, one for each case, updating them automatically in hardware.

       

      But it doesn't seem to be able to route this because of the input MUX.  It gives a confusing error message:

       

      Cannot use pin PIN(0) as digital HW output when it is connected to an analog HW mux.

       

      If a GPIO pin is connected to an AMuxHW component, its digital input is expected to be used by the matching digital control signal on the AMuxHW component. So this GPIO pin's digital input signal should be reserved for the matching digital control signal on AMuxHW component only.

       

      Actually the pin is not set to anything other than analog input, but I think it's just because it can't connect a single GPIO to multiple MUX inputs.

       

      Any other solutions?  The thresholds in this case are 600, 1380, and 1490 mV, so not something I can just generate with VRef components and use separate comparators.  Any way to make the Mux accept the single pin input?