beautypg.com

Table 5-2: spi syntax character definitions – PNI CommBoard User Manual

Page 12

background image

PNI Sensor Corporation

DOC#1018122 r02

PNI CommBoard User Manual

Page 10

Table 5-2 defines the characters used in the syntax description. Note that when {NIML} or

(NIML) is used to define the word length, only N, I, M, or L should be present, not all four.

If the word length is optional and no word length is defined in the sentence, then the prior

specified word length will be used. Similarly, if the delimiter is optional and no delimiter is

provided, then the prior specified delimiter will be used on return data. This holds when

switching from a Read to a Write command, and vice-versa.

Table 5-2: SPI Syntax Character Definitions

Character

Definition

( )

Required parameter inside parentheses

{ }

Optional parameter inside brackets

#

Number (data). Can include minus (-).

S, s

Treat incoming word as a signed value

N, n

Int8 value follows or is requested

I, i

Int16 value follows or is requested

M, m

Int24 value follows or is requested

L, l

Int32 value follows or is requested

W or w

– SPI Write

This character indicates a Write command. The data word is sent once a delimiter or

another command character is received from the host. The syntax is:

W{NIML}#(delimiter){{NIML}#(delimiter)..}{}

The data is #, and the data‟s word length is defined by either N, I, M, or L, as set out

in Table 5-2. If the optional carriage return is sent, it first serves as a delimiter to

complete a write value and next it serves to terminate this command such that the
character „W‟ or „w‟ has to be reissued to send additional data. Note that is not
stored as the last used delimiter (see Delimiter section for details).

Multiple words of varying word lengths can be sent in one sentence. The operands
„N‟, „I‟, „M‟ or „L‟ define the word length of the subsequent data being sent. These
can be upper or lower case. This operand does not need to be repeated if the word

length does not change.

Example: dWN123,456,i789

“d” sets the CommBoard to decimal mode. “W” defines this action as a Write
command. “N” defines the word length as 8-bits. “123” is the first set of data, in

decimal format. The delimiter is “,”. The next set of data, “456”, gets reduced to
“200” because 456 overflows the 8-bit word (255 max) and “200” is what remains
in the LSB. “i” changes the word length to 16-bits. “789” gets converted into “3”