A p-type or n-type semiconductor can be converted into a p-n junction by doping it with suitable impurity. The motion of majority charge carriers causes diffusion current across the junction while the barrier electric field causes motion of minority carriers for drift current. In case of unbiased diode, the diffusion and drift currents are equal. This equilibrium is disturbed by the biasing batteries. Diodes, therefore, allow currents in one direction. This property of diode is used in making rectifiers.