This paper introduces a real-time high precision measurement of phase difference based on Field Programmable Gate Array(FPGA) technology,which has been successfully applied to laser grating interference measurement and real-time feedback of plasma electron density in HL-2A tokamak.It can track the changes of electron density while setting the starting point of the density curve to zero.In a laboratory test,the measuring accuracy of phase difference is less than 0.1°,the time resolution is 80 ns,and the feedback delay is 180 μs.