Remote-processing RPC-210 Uživatelský manuál Strana 24

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 60
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 23
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 Chip select (I/O address 0A307H)
14 MSIO - Data to device
16 MOSI - Data from device
18 SCLK - serial clock to device
Additional chip selects are available at J3. Be sur e to
configure the appropriate port (A, B, or C) as an output.
Command SP I both reads and wr ites out the SPI port.
SCON reads and writes to the SPI configuration register.
Data range for both SCO N and SP I is 0-255. Data is
transferred 8 bits at a time. For an example of
transferring 16 data bits at a time, review SPI.BAS.
This exam ple progr am uses SPI com mands to w rite to
the on board COM 1 UART.
The following program fragment shows how to use SPI
and SPICON.
10 SPI = 80H Write to SPI port
20 RX = SPI Read from SPI port
30 SCON = 30h Write to configuration
register (30H is default)
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
RPBASIC-52, is in parens. Use the SC ON c omm and to
write to the SPI configuration register.
Increasing the clock r ate (SPR 0,1) will not speed up data
access.
Bit
Pos
Name Description
0,1 SPR0,1 Clock rate select (0,0 = 2.74
MHZ)
2 CPHA 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 programs 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.
Zobrazit stránku 23
1 2 ... 19 20 21 22 23 24 25 26 27 28 29 ... 59 60

Komentáře k této Příručce

Žádné komentáře