Patent attributes
A method, a magnetic field sensor, and an electronic device measure and determine the magnitude and/or the direction of a magnetic field. The magnetic sensor is based on at least a first magnetoresistive-layered structure having an electric resistance depending on the magnitude of the magnetic field. The magnetic sensor generates at least a first offset magnetic field. The magnitude and the direction of the offset magnetic field can be modified to compensate the magnetic field. The electric resistance of the magnetoresistive-layered structure depends on the superposition of magnetic field and offset magnetic field. A maximum electric resistance indicates that the magnetic field is compensated by the offset magnetic field. In this case the magnitude of the magnetic field corresponds to the magnitude of the offset magnetic field, and the direction of the magnetic field is given by the reversed direction of the offset magnetic field.