Patent ID: 7418359

Claim:
A magnetic sensor control device comprising: an input section that input a plurality of magnetic data having 2 components sequentially output from a 2-dimensional (2D) magnetic sensor; a buffer that stores the plurality of magnetic data; a selection section that selects 3 magnetic data satisfying a predetermined 3-point selection condition from the plurality of the stored magnetic data; wherein, when new magnetic data is stored in the buffer, the selection section selects one of 3 data structures provided for storing 3 magnetic data as candidates for selection, and updates the selected data structure with the new magnetic data stored in the buffer, provided that the length of a chord of a circular arc passing through 3 points corresponding to the 3 magnetic data stored in the 3 data structures is increased or at least is not decreased by updating the one data structure, in which magnetic data corresponding to one of the two points at both ends of the circular arc is stored, with the new magnetic data stored in the buffer, such that the 3 data structures store first magnetic data and second magnetic data which correspond to two points at both ends of the circular arc and one of which is the new magnetic data; wherein, when new magnetic data is stored in the buffer, the selection section obtains magnetic data which has not been selected as any candidate for selection of the first and second magnetic data corresponding to the two points at both ends of the circular arc, and sets the obtained magnetic data as a candidate for selection of third magnetic data of an intermediate point of the circular arc, and wherein the selection section determines whether or not a set of the first, second and third magnetic data satisfies the predetermined 3-point selection condition; a calculation section that calculates a center point equally distant from 3 points each represented by 2 components of a corresponding one of the 3 selected magnetic data; and a setting section that sets 2 components representing the center point as an offset of the magnetic data.