beautypg.com

PNI CommBoard User Manual

Page 13

background image

PNI Sensor Corporation

DOC#1018122 r02

PNI CommBoard User Manual

Page 11

for the MSB and “21” for the LSB. In summary, the following is sent after the

complete Write command is executed (in decimal notation): 123 ,200 ,3 ,21.

Example:

Wi1,n1

The command will send the number “1” twice, once as a 16-bit word and next as
an 8-bit word. The send bytes will look like 00,01,01.

R or r

– SPI Read

This character initiates a Read operation. The syntax is:

R{#n}{S}(NIML){{#n}{S}(NIML).....}{}

Example: Rni

This command will read an 8–bit word and then a 16-bit word.

Note the word length character (NIML) must be sent for a Read operation, although

it is optional for a Write operation. A delimiter can be inserted at any point to change

the delimiter used for the data returned to the host.

Note the Read command supports a Write-Simultaneous-With-Read operation. In

this case only 8-bit words are supported. Hence {#n} in the syntax. See Section

5.2.1 for an example.

, , , or

– Delimiters

Anytime a delimiter character is sent it will set the delimiter character used for

separating data in the output after a Read command sequence. Once the delimiter is

set, it will be retained until a subsequent command changes the delimiter.

Unlike other delimiters, a will terminate a command such that you need to send

the command character again to use the command again. will not store as the

delimiter for subsequent data; rather, the prior delimiter will be retained.

Terminating a Read command with a , as opposed to a character of the next

command, will cause a character to be sent out the UART. If you intend to use

Matlab to read the incoming values you will want to terminate with a so that it

is compatible with the fscanf() function.

X or x

– Hex/Decimal Mode

Sets the protocol to hexadecimal or decimal. “X” sets the protocol to hexadecimal,
while “x” sets it to decimal. Once the protocol is set, it will be retained until a
subsequent command changes the protocol. On power-up, the default is “X”. Also,

when hexadecimal mode is selected, hexadecimal digits “a” through “f” must be

lower case.