The influence of electron cyclotron wave (ECW) injection with different deposition positions and injection powers on the evolution of peeling–ballooning (P–B) modes is studied with the BOUT++ code, in which the energy deposition and current drive of the ECW are calculated using a ray tracing code. It is shown that the changes in the profiles of plasma pressure, current density, and resistivity induced by ECW injection can significantly influence the linear property and the nonlinear evolution of P–B modes. For the linear simulation, the ECW deposited at the top of the pedestal makes the high toroidal mode number (n) P–B modes more unstable; however, it stabilizes the medium-n to high-n P–B modes when the ECW is deposited at the middle of the pedestal, and the ECW deposited at the bottom of the pedestal decreases the growth rate of P–B modes with medium-n. Further investigation shows that the injected ECW influences the characteristic of linear P–B modes by changing the diamagnetic effect, magnetic shear, pressure gradient, current density, resistivity, and so on. It is known from the nonlinear simulation that the energy loss caused by the edge localized mode (ELM) with ECW injection deposited at the top of the pedestal is nearly the same as that in the case without ECW injection, while the ECW deposited at the middle and bottom of the pedestal is helpful to decrease ELM energy loss. According to the analyses of the time evolution of the P–B mode toroidal spectrum, the physical mechanism of the decrease in ELM energy loss in the simulation is that ECW injection suppresses the most unstable toroidal harmonic of the P–B mode. On the other hand, the influence of ECW injection on P–B modes becomes more obvious when the power of the injected ECW increases. Moreover, the influence of current driven by the ECW on P–B modes is studied separately in this paper, which plays a different role from the bootstrap current.