beautypg.com

Making a measurement, 4 making a measurement – PNI MicroMag User Manual

Page 23

background image

MicroMag User Manual

– March 2010

Page 23 of 23

5.4 Making a Measurement

To make a sensor measurement, a command byte is sent to the MicroMag through

the SPI port specifying the sensor (axis) to be measured and the “Period Select”. The

Period Select defines the number of oscillation cycles (periods) to be measured in both

the forward and reverse bias directions. A sensor measurement consists of measuring

the time required to complete the host-specified number of oscillation cycles (set by the

Period Select) in both the forward and reverse bias directions. The measurement is

ma

de with the PNI ASIC’s internal high speed clock, which runs at nominally 2 MHz.

The MicroMag returns the difference between the two measurement times represented

as a number in a 16-

bit 2’s complement format (range: -32768 to 32767), and this

number is directly proportional to the strength of the local magnetic field in the direction

of the specified axis. Note that the greater the Period Select value, the higher the

resolution of the measurement and the longer the sample time.

The sequence and timing are discussed in Section 5.1 and the command byte

syntax is discussed in Section 5.2.

The steps to make a sensor measurement are as follows:

1. SSNOT pin is set LOW. (This enables communication with the master device.)

2. RESET pin is set HIGH, then LOW. This will reset the PNI ASIC. It is necessary

to reset the MicroMag before each measurement.

3. A command word is clocked into the MicroMag on the MOSI pin. Once 8 bits

have clocked in, the MicroMag will execute the command (take a measurement).

4. A measurement consists of forward biasing the sensor and making a period

count; then reverse biasing the sensor and counting again; and then taking the

difference between the two directions.

5. At the end of the measurement, the DRDY line is set HIGH, indicating data is

ready. The data is clocked out on the MISO pin with the next 16 clock cycles.

If another measurement is to be made, start at Step 2. The next command can be

sent after resetting. In this case, SSNOT should be kept LOW. If the MicroMag will not

immediately be used again and there are other devices on the SPI bus, set SSNOT to

HIGH to free up the SPI bus.