This paper proposes a kind of grating ruler design using full closed-loop feedback of numerical control equipment. One of the gratings that make up the grating ruler is a vertical line grating, and the other is a straight oblique line grating. The vertical grating and the vertical grating area of the straight slanted grating form vertical Moiré fringes, and the vertical grating and the oblique grating area of the straight slanting grating form horizontal Moiré fringes. The included angle is 0º. The two gratings move relative to each other for one grating pitch, the vertical Moiré fringes scroll left and right by one vertical Moiré fringe width, and the horizontal Moiré fringes scroll up and down by one horizontal Moiré fringe width. There is a two-dimensional photosensitive diode array fixed on the left and right moving grating for photoelectric detection, and the number of photosensitive diodes is a G*G matrix array. The photodiode arrays in the horizontal and vertical Moiré fringe areas are respectively connected to their respective decoding circuits to output dual-channel IQ signals of the same frequency, (Ic, Qc) and (Is, Qs). The invention has the advantages of very excellent anti-interference ability, in addition, the output signal of the photosensitive diode is amplified and accumulated to output a standard orthogonal signal, the circuit is mature, and the technical complexity does not increase.