Tapping mode is one of the most commonly used scan mode in atomic force microscope (AFM). As feedback signal of control loop, the amplitude of probe vibration in tapping mode scan should be measured real-time. The regular analog method to measure amplitude leads to inevitable measure error because of intrinsic thermal drift of analog device. The regular digital measuring method realizes a less error by using digital technology but introduce a large amount of calculation. This paper presents a modified digital lock-in amplifier (MDLIA) for amplitude measurement in tapping model scan in a custom-built AFM which realize less error without increasing calculation. The proposed method using a square wave signal which has same frequency and phase with vibration signal to realize amplitude measurement within only one-channel computing. Firstly, principle of MDLIA was introduced through theoretically analysis; then come description of each component and implementation process; finally, MDLIA was validated through three kinds of experiments, 1) less calculation and higher speed was validated through time consumption experiments, 2) accuracy was validated through error comparison experiments, 3) stability was validated through standard grating scan experiments.