beautypg.com

2 sam command byte, 3 making a single-axis measurement, Sam command byte – PNI RM3000-F Sensor Suite User Manual

Page 32: Making a single-axis measurement, Table 5-2: sam axis select bits

background image

PNI Sensor Corporation

Doc #1016102 r04

RM3000-f & RM2000-f Sensor Suite User Manual

Page 32

5.2.2 SAM Command Byte

The SAM Command Byte is defined as follows:

Bit #

7

6

5

4

3

2

1

0

Value

0

0

0

0

0

0

AS1 AS0

Table 5-2: SAM Axis Select Bits

Axis Measured

AS1

AS0

No axis measured

0

0

X axis

0

1

Y axis

1

0

Z axis

1

1

5.2.3 Making a Single-Axis Measurement

The steps to make an interrupt-driven single X-axis sensor measurement are given below.

The 3D MagIC will return the result of a complete forward-reverse measurement of the

sensor in a 24-bit 2’s complement format (range: -8388608 to 8388607).

SSN pin is set LOW. This enables communication with the master device.

Send 0x01 on the MOSI pin to the 3D MagIC. This is the SAM Command Byte

to take a measurement on the X-axis sensor. Simultaneously, the 3D MagIC will

present a fixed 0x9A on the MISO pin. If the MISO pin reads 0x9B, then the 3D

MagIC is in Legacy Mode. Once the 8 bits have clocked in, the 3D MagIC will

execute the command (i.e. take a measurement).

The SSN input may be returned HIGH at this point to free up host communication

with another device if desired. This will not affect the measurement process.

A measurement is taken.

At the end of the measurement, the 3D MagIC will set the DRDY pin to HIGH,

indicating data is ready, and the 3D MagIC will enter Idle Mode.

The SSN input should be set LOW, if it is not already, to read the data.

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

If another measurement is immediately made, SSN can remain LOW and the process

repeated. Otherwise it is recommended that SSN is set HIGH to release the SPI bus.