The Serial Peripheral Interface (SPI)

Slides:



Advertisements
Similar presentations
kashanu.ac.ir Microprocessors 6-1 I/O Devices Switches, LED, LCD Lec note 6.
Advertisements

Input/Output (I/O) Ports and Interfacing
Input/Output Ports and Interfacing ELEC 330 Digital Systems Engineering Dr. Ron Hayne Images Courtesy of Ramesh Gaonkar and Delmar Learning.
ECE 371 Unit 13 - Part 1 Serial Peripheral Interface (SPI)
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
Calculator 9S12DP256 Lab 2. \ Convert counted string at addr1 to double number ud2 \ ud1 normally zero to begin with \ addr2 points to first invalid character.
HD44780 LCD programming From the Hardware Side Design and implementation details on the way to a valid SPI-LCD interface driver.
Spring EE 316 Computer Engineering Junior Lab LCD modules.
The Serial Peripheral Interface (SPI) Chapter 8. SPI Operation of the SPI Keypad Interfacing with Shift Registers 4-Digit Seven-Segment Display.
Parallel Ports Lecture L4.1. Parallel Interfacing Parallel I/O Ports Using Parallel Ports.
Spring EE 316 Computer Engineering Junior Lab LCD modules, PROMs, Serial Ports.
Digilab DIO2 LCD Module F5.1. DIO2 circuit board block diagram.
Subroutines and Stacks Lecture L3.1. Subroutine and Stacks The System Stack Subroutines A Data Stack.
Embedded Systems 7763B Mt Druitt College of TAFE Electrical Engineering Lesson 2 LCD Display Interfacing.
OUTLINE WHAT ? HOW ? WHY ? BLUEPOST Poster and Message Content Specified by the User Displaying the Poster Content on a Monitor Sending Messages to.
LCD Display DIO2 Board CPLD. DIO2 Board CPLD Interface LCD Display.
HC12 and LCD, Jianjian Song, Dept. of Electrical and Computer Engineering Interfacing the HC(S)12 microcontroller to a Hitachi/Optrex LCD Display Panel.
Eejit’s guide to using a LCD alphanumeric display with the CCS C compiler 1.Hardware connection 2.The LCD.C include file 3.An example.
16x2 LCD Module on DE2-115 數位電路實驗 TA: 吳柏辰 Author: Trumen.
SPI Compatible Devices Design and implementation details on the way to a valid SPI-LCD interface driver.
Overview What kind of LCD Interfacing the LCD Displaying Text and Numbers Common Issues.
Digital Outputs LCD Display
The Serial Peripheral Interface (SPI) Chapter 8 CML9S12-DP256.
HD44780 LCD programming From the Hardware Side
Input/Output Ports and Interfacing
Serial I/O and the HC11. Overview General discussion of serial I/O operations oSynchronous vs. asynchronous operations oBaud rate vs. bit rate oTransmission.
LCD Interfacing.
CS-280 Dr. Mark L. Hornick 1 Programming for the LCD Display.
UniMAP 1 Interfacing Peripherals. UniMAP 2 Interfacing devices on Embedded Linux In general, to interface to a device connected to an embedded Linux platform.
EE 316 Computer Engineering Junior Lab Serial Ports, LCD Displays & PROMs.
9-1 EE 319K Introduction to Microcontrollers Lecture 9:I/O Synchronization; LCD Interfacing; Implementing Local Variables using a Stack Frame; Parameter.
Parallel Interfacing Chapter 7. Parallel Interfacing Parallel I/O Ports Using Parallel Ports Seven-Segment Displays Keypad Interfacing Liquid Crystal.
1 October 26, 2006ME 6405 MechatronicsSerial Communication Interface Brian Guerriero Jon Rogers Robert Thiets.
Keypad Lecture L4.6. Port Integration Module PIM_9C32 Block Guide V01.06 Reference: S12C32PIMV1.pdf.
Example 12 Pulse-Width Modulation (PWM): Motors and Servos Lecture L8.1.
Embedded Systems 7763B Mt Druitt College of TAFE Electrical Engineering Lesson 2 LCD Display Interfacing.
Chapter 10 Glass Bliss Using the Parallel Master Port to communicate with Alphanumeric LCD displays.
The Serial Communication Interface (SCI) MC9S12-C32
Programming Microcontrollers in C Lecture L7.1. C Data Types TypeSizeRange char1 byte-128 – 127 unsigned char1 byte0 – 255 Int2 bytes – unsigned.
Parallel I/O. Introduction This section focuses on performing parallel input and output operations on the 68HC11 3 operation types – Simple, blind data.
Department of Electronic & Electrical Engineering LCD character display (parallel interface). How to interface a LCD character display to a PIC.
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
Computer Operating Properly Module MTT COMPUTER OPERATING PROPERLY MODULE (COP)
Embedded Systems February 10, Serial Interface - SPI  Serial Peripheral Interface  Synchronous communications  Clock supplied by the Master.
I/O Devices Switches, LED, LCD
Physics 413 Chapter 4: Advanced Assembly Programming.
1 Subroutines Advanced Programming. 2 Top-Down approach to problem solving Algorithm step by step description of how to solve a problem Divide and Conquer.
Vishwakarma government engineering college Prepare by. Hardik Jolapara( ) LCD Interfacing with ATmega16.
Interfacing of Input/Output devices with AVR Microcontroller Enrolment No. : Name of the student: SOMAIYA ISHA.
ELE22MIC Lecture 17 Writing 68HC11 software 68HC11 Main Timer System –Output Compare –What is different about TOC1?
Sitarambhai Naranjibhai Patel Institute of Technology and Research Centre, Umrakh, Bardoli. A Presentation On “ 16x2 LCD Interfacing with AVR atmega32.
LCD AND LCD INTERFACING. INDEX:-  INTRODUCTION  PIN DISCRIPTION  INITIALIZATION OF LCD  LCD INTERFACING  LCD INTERFACING WITH ATMEGA 32  INTERFACING.
Peripherals – Keypad The Keypad provides a simple means of numerical data or control input. The keys can be attributed whatever data or control values.
LCD Interfacing using Atmega 32
Interfacing the HC(S)12 microcontroller to a Hitachi/Optrex LCD Display Panel The LCD display panel contains its own microcontroller (Hitachi HD44780)
UNIVERSAL COLLEGE OF ENGINEERING & TECHNOLOGY
GANDHINAGAR INSTITUTE OF TECHNOLOGY
DIGITAL CALCULATOR USING 8051
SPI Compatible Devices
Example 10 ASCII String to Binary Conversion
Branching and Looping Lecture L3.2.
SPI Protocol and DAC Interfacing
Example 16 Circular Queue
Example 13 The Serial Peripheral Interface (SPI)
Example 7 Liquid Crystal Display
SPI Compatible Devices
HD44780 LCD programming From the Hardware Side
HD44780 LCD programming From the Hardware Side
DIO2 Board Projects.
Accum A: Index X: CCR Bit Z: $0100 $0101 $0102 $0103 $0104 $0105
Presentation transcript:

The Serial Peripheral Interface (SPI) Lecture L4.5

Reference SPI Block Guide V03.06 S12SPIV3.pdf

PIM_9C32 Block Diagram SPI module

$DA

$D8

$D8

$D8

$D9

$D9

$DB

$DB

Liquid Crystal Display

Relationship between RS, R/W, and E

CLM912C32 LCD PORT 4-bit SPI Interface Write only

File: spi.asm ; Serial Peripheral Interface SPI0 SPI0CR1 equ 00D8 ; SPI Control Register 1 SPI0CR2 equ 00D9 ; SPI Control Register 1 SPI0BR equ 00DA ; SPI Baud Rate Register SPI0SR equ 00DB ; SPI Status Register SP0DR equ 00DD ; SPI Data Register   spi_init ; Initialize SPI port ldaa #$10 staa SPI0CR2 ; enable /SS clr SPI0BR ; 4 MHz (/2) ldaa #$52 staa SPI0CR1 ; CPHA = 0, CPO; = 0 rts

File: spi.asm (cont.) ; send A out spi send_spi psha ; save A ss0 ldaa SPI0SR anda #$20 beq ss0 ; wait for trans. buff empty pula ; get A psha ; save it again staa SP0DR ; send char ss1 ldaa SPI0SR anda #$80 beq ss1 ; wait till sent ldaa SP0DR ; clear SPIF pula ; restore A rts

SPI0CR1 $D8

; LCD for Axiom CML9S12-C32 #include hex2asc.asm #include spi.asm #include ms_delay.asm   ; Write 4-bit instruction in A instr4 psha ;save A anda #$0f jsr send_spi ;EN LO, RS LO oraa #$80 ;EN HI jsr send_spi pula ;get A jsr send_spi ;EN LO pula ;restore A rts

; Write 8-bit instruction in A psha ;save A lsra bsr instr4 ;send hi nibble pula ;get A bsr instr4 ;send lo nibble rts

; Write 4-bit data in A data4 psha ;save A anda #$0f oraa #$40 ;EN HI jsr send_spi ;EN LO, RS HI pula ;get A oraa #$C0 ;EN HI jsr send_spi psha oraa #$40 jsr send_spi ;EN LO pula pula ;restore A rts

; Write 8-bit data in A data8 psha ;save A lsra bsr data4 ;send hi nibble pula ;get A bsr data4 ;send lo nibble rts 

; Initialize 4-bit wide lcd_init ldy #50 jsr ms_delay ldaa #3 jsr instr4 ; function set ldaa #2 ldaa #$2C jsr instr8 ; 4-bits, 2 lines ldy #10 ldaa #$06 jsr instr8 ; inc cursor ldaa #$0f jsr instr8 ; display on ldaa #$01 jsr instr8 ; clear display ldy #20 ldaa #$80 jsr instr8 ; set addr to 0 ldaa #$00 jsr send_spi ; turn off all signals rts

clear_lcd ldaa #1 jsr instr8 ldy #10 jsr ms_delay rts ; display hex value in A on LCD  hex2lcd jsr hex2asc ;convert to ascii jsr data8 ;display it ; display asciiz string on LCD ; X -> asciiz string  type_lcd ldaa 1,x+ ;get next char beq done ;if null, quit jsr data8 ;else display it ldy #10 jsr ms_delay ; delay 10 ms bra type_lcd ;and repeat done rts

; lcdtest.asm org $800 mess1 db 'Haskell',0 org $4000 main jsr spi_init jsr lcd_init ldx #mess1 jsr type_lcd swi #include lcd.asm

1: ; lcdtest.asm 2: 3: =00000800 org $800 4: 0800 48 61 73 6B 65 6C mess1 db 'Haskell',0 0806 6C 00 5: 6: =00004000 org $4000 7: 8: 4000 main 9: 4000 16 4019 jsr spi_init 10: 4003 16 4088 jsr lcd_init 11: 4006 CE 0800 ldx #mess1 12: 4009 16 410A jsr type_lcd 13: 400C 3F swi

16 x 1 Hex Keypad