During the writing operation, the wafer potential is dynamically detected
and corrected. By doing so, the positional accuracy of the circuit
patterns written on a wafer can be improved. After a contact resistance
between a wafer and a earth pin is measured, the current flowing from the
wafer to the ground potential via the earth pin is measured. Then, based
on the measurement result, the potential difference is given between the
wafer and the ground potential.