Remote Processing RPC-210 User Manual
Page 24

SERIAL & SPI PORTS
BASIC
SECTION 4
Page 4-6
SPI PORT
Signals to communicate write to SPI compatible devices
are available at J7. Relevant signals are shown below:
J7 Pin
Description
10
C h ip s el e ct (I / O ad d r es s 0 A 30 7 H )
14
MSIO - Data to device
16
MOSI - Data from device
18
SCLK - serial clock to device
Additional ch ip selects ar e available at J3 . Be sur e to
configur e the appr opriate po rt (A, B, or C) as an o utput.
Com mand SP I both rea ds and wr ites out the SPI port.
SCON reads and writes to the SPI configuration register.
Data r ange for both SCO N and SP I is 0-255. Data is
transferred 8 bits at a time. F or an example of
transferring 16 data bits at a time, review SP I.BAS.
This exam ple progr am uses S PI com mands to w rite to
the on board COM 1 UART.
The following program fragment shows how to use SPI
a n d S P IC O N .
10 SPI = 80H
Write to SPI port
20 RX = SPI
Read from SPI port
30 SCON = 30h
Write to configuration
register (30H is def ault)
Possible configurations for SPI communication are
described below. Usually the only changes necessary
are the CPH A and CPO L bits. Pow er up default, set by
RPBA SIC-52, is in parens. Use the SC ON c omm and to
write to the SPI configuration register.
Increa sing the clock r ate (SPR 0,1 ) will not speed up data
access.
Bit
Pos
N a m e
Description
0,1
S PR 0, 1
Clock rate select (0,0 = 2.74
M H Z )
2
C P H A
Clock phase select (0 = leading
edge latch)
3
CPOL
Clock polarity (0 = idles low)
4
SPIM
Master/ slave mode select (1 =
master)
5
SPE
SPI enable (1 = enable)
6
WCOL
Write collision error flag
7
ISPI
SPI interrupt (not used)
APPLICATION PROGRAMS
The following program s are in the BASIC 52 directory.
File
Description
210_MULT.BAS
Multitasking routines
with ON COM
RDRTS1.BAS
Read and display status
of RTS signal from
external device.
WRCTS1.BAS
Set CTS output high and
low.