Tip: Alternate digital voltage thresholds on microcontrollers with schmitt trigger inputs

So, you've got a TTL signal and you want to read it with a schmitt trigger input. But the problem is, while the voltage low threshold is fine, the voltage high threshold is... too high. Your input will never read a 1.

What do?

Well, if your circuitry can handle the input pin being driven high by the microcontroller (maybe an input resistor would help), do exactly that and then switch it back to input mode just prior to reading the pin (but allow enough time for the voltage transitions to actually occur when the chip is running fast enough).

The deliberate positive output pulse will switch the schmitt trigger input to being high, and it will stay high unless it crosses past the low voltage threshold due to the real input. Problem solved.

This trick should also work in the other case where you have a high signal that doesn't get low enough when low, or even if you need to separate the input into 3 ranges (eg, reading a 3 position switch).

Note: Watch out for noise interaction with thresholds...

^^The ^^more ^^you ^^know!

Posted May 25, 2015, 4:14 PM UTC · edited

13
electric_machinery•

Ouch! If it works, it works

2
Hadrosauroidea•

Yeah, I'm not seeing that under 14 CFR Part 25.

0
bradnOP•

[Insert standard disclaimer about advice not being used in life support situations without prior written approval from the president of the company]

1