C commands – PNI CommBoard User Manual

Page 21

Advertising
background image

PNI Sensor Corporation

DOC#1018122 r02

PNI CommBoard User Manual

Page 19

6.1 I

2

C Commands

{ or [

– Start Read or Write Packet

The open brackets are used to start an I

2

C Read or Write packet. It does not matter

which is used, as the end of the packet defines the type of transaction.

} or R or r

– Finish Read Packet

An end curly bracket, an „R‟ character, or an „r‟ character finishes construction of an

I

2

C packet to read data from the slave device and sends the packet to the slave device.

The syntax of the packet is:

{SLA REG NUM}

Where:

All numbers must be in 2-digit hexadecimal format. For example, the value

zero must be represented as “00” and the value one as “01”. As a result, no
delimiter is necessary.

SLA is the 7-bit slave address in the 7 MSBits, plus the r/w bit in the LSB.

However, the value of the r/w bit does not matter, as the CommBoard ensures
the r/w bit is properly set. For example, the SpacePoint Scout‟s 7-bit slave
address is 0x0C, and shifting it into the 7 MSBits makes SLA = 0x18. Even if

the LSB, or r/w bit, is set to “0” indicating a write operating, the CommBoard

will transmit SLA = 0x19, effectively changing the LSB to reflect a read

operation.

REG either can be the first register number to start reading from or a

command number depending on client hardware protocol.

NUM is the number of data bytes to read.

Example #1:

{183108} requests and returns 8 bytes of data starting at register 0x31. For the
SpacePoint Scout, the data will be quaternion data in 4x 2 bytes.

Example #2:

{193314} requests and returns 20 bytes (0x14 bytes) of data starting at register
0x33. While the r/w bit is populated with a “1”, such that the SLA byte = 0x19,

the CommBoard uses the closing curly bracket, “}”, to recognize this as a read

operation and ignores the r/w bit. For the SpacePoint Scout, the cursor position,

Hpos and Vpos, will be returned in the final 2x 4 bytes.

Advertising