A microscopic theory of the quantized Hall effects