The Serial Peripheral Interface (SPI) - PowerPoint PPT Presentation

Loading...

PPT – The Serial Peripheral Interface (SPI) PowerPoint presentation | free to download - id: 4b430d-Y2IzY



Loading


The Adobe Flash plugin is needed to view this content

Get the plugin now

View by Category
About This Presentation
Title:

The Serial Peripheral Interface (SPI)

Description:

The Serial Peripheral Interface (SPI) Chapter 8 CML9S12-DP256 Liquid Crystal Display The Serial Peripheral Interface (SPI) Chapter 8 CML9S12-DP256 Liquid Crystal ... – PowerPoint PPT presentation

Number of Views:87
Avg rating:3.0/5.0
Slides: 27
Provided by: hask
Category:

less

Write a Comment
User Comments (0)
Transcript and Presenter's Notes

Title: The Serial Peripheral Interface (SPI)


1
The Serial Peripheral Interface (SPI)
  • Chapter 8
  • CML9S12-DP256

2
PIM_9DP256 Block Diagram
3
(No Transcript)
4
(No Transcript)
5
(No Transcript)
6
(No Transcript)
7
(No Transcript)
8
(No Transcript)
9
(No Transcript)
10
(No Transcript)
11
(No Transcript)
12
(No Transcript)
13
(No Transcript)
14
(No Transcript)
15
(No Transcript)
16
(No Transcript)
17
Liquid Crystal Display
18
Relationship between RS, R/W, and E
19
(No Transcript)
20
CLM912-DP256 LCD PORT 4-bit SPI Interface Write
only
21
File SPI0.WHP
\ Serial Peripheral Interface SPI0 HEX 00D8 CONSTA
NT SPI0CR1 \ SPI Control Register
1 00D9 CONSTANT SPI0CR2 \ SPI Control
Register 1 00DA CONSTANT SPI0BR \ SPI
Baud Rate Register 00DB CONSTANT SPI0SR
\ SPI Status Register 00DD CONSTANT SP0DR
\ SPI Data Register   SPI.INIT ( -- )
\ Initialize SPI port 10 SPI0CR2 C! \
enable /SS 00 SPI0BR C! \ 4 MHz (/2) 52
SPI0CR1 C! \ CPHA 0, CPO 0   ?SPI.DONE
( -- f ) \ Is SPI data sent? 7 SPI0SR
?HI   SEND.SPI ( c -- ) SP0DR C!
\ send char BEGIN ?SPI.DONE \
wait till sent UNTIL SP0DR C_at_ DROP \
clear SPIF
22
(No Transcript)
23
\ LCD for Axiom CML9S12-DP256 load
hex2asc.whp load string.whp load
spi0.whp   DECIMAL   10ms.delay ( -- )
7267 FOR NEXT   20ms.delay ( -- )
10ms.delay 10ms.delay  
50ms.delay ( -- ) 5 FOR
10ms.delay NEXT  
24
HEX \ Write 4-bit instruction gtinstr4
( n -- ) 0F AND DUP
send.spi \ EN LO, RS LO DUP 80 OR \ EN
HI send.spi send.spi \ EN LO   \ Write
8-bit instruction gtinstr8 ( n -- ) DUP 4
RSHIFT gtinstr4 gtinstr4   \ Write
4-bit data gtdata4 ( c -- )
0F AND DUP 40 OR send.spi \ EN LO, RS
HI DUP C0 OR send.spi \ EN HI 40 OR
send.spi \ EN LO   \ Write 8-bit data
gtdata8 ( n -- ) DUP 4 RSHIFT gtdata4 gtdat
a4
25
\ Initialize 4-bit wide lcd.init ( --
) 50ms.delay 3 gtinstr4
\ function set 50ms.delay 3
gtinstr4 \ function set 50ms.delay
3 gtinstr4 \ function
set 50ms.delay 2 gtinstr4
\ function set 50ms.delay 2C gtinstr8 \
4-bits, 2 lines 10ms.delay 06 gtinstr8 \
inc cursor 10ms.delay 0f
gtinstr8 \ display on 10ms.delay
01 gtinstr8 \ clear
display 20ms.delay 80 gtinstr8
\ set addr to 0 10ms.delay 0
send.spi \ turn off all signals
0A BASE ! \ decimal default
26
clear.lcd ( -- ) 1 gtinstr8
10ms.delay   hexgtlcd (
hex -- ) HEX2ASC gtdata8  
type.lcd ( addr len -- )
?DUP IF 0 DO
DUP C_at_
gtdata8 10ms.delay 1 LOOP
THEN DROP   .lcd
( n -- ) (.) type.lcd
  u.lcd ( u -- ) (u.)
type.lcd   DECIMAL
About PowerShow.com