Converting analog to digital

What kind of signal is applied to the pin? If it is really an analogue signal, you should include a hyteresis. Otherwise, your digital signal will become unstable when the external voltage equals the threshold voltage.
With digitalRead, there is an internal Schmitt trigger that provides hyteresis.