Example 13 The Serial Peripheral Interface (SPI)

Slides:



Advertisements
Similar presentations
LOGO Lab Supervisor – Dr. WH Lau EE3271 Design Laboratory.
Advertisements

ECE 371 Unit 13 - Part 1 Serial Peripheral Interface (SPI)
Example 11 Analog-to-Digital Converter Lecture L5.1.
Outline  Examine some of the H/W supplied with a typical PC and consider the software required to control it.  Introduce Commkit, a software tool that.
The Serial Peripheral Interface (SPI) Chapter 8. SPI Operation of the SPI Keypad Interfacing with Shift Registers 4-Digit Seven-Segment Display.
6/21/20151 One-Wire Bus Digital Thermometer Example.
Serial Peripheral Interface (SPI)
HT46 A/D Type MCU Series Data Memory (Byte) Program Memory HT46R22 (OTP) HT46C22 (Mask) 2Kx Kx16 4Kx HT46R23 (OTP) HT46C23 (Mask) HT46R24.
4-Bit Binary-to-BCD Converter: case Statement
The Serial Peripheral Interface (SPI)
NS Training Hardware. System Controller Module.
Serial Peripheral Interface (SPI) Bus. SPI Bus There is no official specification for the SPI bus. It is necessary to consult the data sheets of the devices.
The Serial Peripheral Interface (SPI) Chapter 8 CML9S12-DP256.
CS-280 Dr. Mark L. Hornick 1 ASCII table. 2 Displaying Numbers as Text Problem: display numerical values as text Consider the numerical value 0x5A held.
UNIT 8 Keypad Interface Contact Closure Counter Exceptions (Interrupts and Reset)
Lecture 9. - Synchronous Devices require a timing signal. Clock generated Interval Timer Microprocessor Interval Timer Clk PCLK = MHz PCLK (for.
1 4-Integrating Peripherals in Embedded Systems. 2 Introduction Single-purpose processors  Performs specific computation task  Custom single-purpose.
The miniDragon+ Board and CodeWarrior Lecture L2.1.
UniMAP 1 Interfacing Peripherals. UniMAP 2 Interfacing devices on Embedded Linux In general, to interface to a device connected to an embedded Linux platform.
Example 11 Analog-to-Digital Converter Lecture L5.1.
Example 12 Pulse-Width Modulation (PWM): Motors and Servos Lecture L8.1.
SPI Test UNIT 26 로봇 SW 교육원 조용수. 학습 목표 SPI Sample SPI Read/Write Function SPI loop back Test MPL115A1 Pressure and Temperature Sensor 2.
7 - 1 Texas Instruments Incorporated Module 7 : Serial Peripheral Interface C28x 32-Bit-Digital Signal Controller TMS320F2812.
Revised: Aug 1, ECE263 Embedded System Design Lessons 27, 28 Serial Peripheral Interface.
Programming Microcontrollers in C Lecture L7.1. C Data Types TypeSizeRange char1 byte-128 – 127 unsigned char1 byte0 – 255 Int2 bytes – unsigned.
UNIT 7 - INTRODUCTION TO I/O INTERFACING. TWO MAJOR TYPES OF I/O INTERFACING ISOLATED I/O - DEDICATED I/O INSTRUCTIONS ARE USED TO ACCESS I/O DEVICES.
Yared Woldekiros Western Washington university WEB ENABLE HOME AUTOMATION.
1 Bits, Bytes, Binary & Hex CIS TAG ▪ Byte Bit.
Examples Lecture L2.2. // Example 1a: Turn on every other segment on 7-seg display #include /* common defines and macros */ #include /* derivative.
Vishwakarma government engineering college Prepare by. Hardik Jolapara( ) LCD Interfacing with ATmega16.
NAM S.B MDLAB. Electronic Engineering, Kangwon National University 1.
INTERFACING KEYBOARD WITH ATMEGA32 ELECTRONICS & COMMUNICATION TITLE.
 The LPC2xxx devices currently have two on- chip UARTS.  Except UART1 has additional modem support.
Serial Peripheral Interface
ECE 382 Lesson 15 Lesson Outline S/W Delays Wrap up
LCD Interfacing using Atmega 32
4-Integrating Peripherals in Embedded Systems (cont.)
Input/Output Ports and Interfacing
TI ARM I/O Programming Chapter 2
Example 14 Real-time Interrupts
UNIVERSAL COLLEGE OF ENGINEERING & TECHNOLOGY
4-Integrating Peripherals in Embedded Systems
Example 19 Measuring Pulse Widths Using Interrupts
4-Integrating Peripherals in Embedded Systems
Chapter D – Serial Connections to the RPi and Analog-to-Digital Converters
8051 Programming in C rhussin.
SPI Protocol and DAC Interfacing
Example 10 ASCII String to Binary Conversion
Example 5 Pushbutton Switches: S1 and S2
Example 9 Binary to ASCII String Conversion
SPI Protocol and DAC Interfacing
Example 6 Hex Keypad Lecture L3.2.
Example 15 Interrupt-Driven Controller
SPI Protocol and DAC Interfacing
Interrupts in C Programs
Example 16 Circular Queue
Analog-to-Digital Converters
82C55 Programmable Peripheral Interface
CS-401 Computer Architecture & Assembly Language Programming
Example 17 SCI Receive Interrupts
Example 7 Liquid Crystal Display
SPI Compatible Devices
HD44780 LCD programming From the Hardware Side
HD44780 LCD programming From the Hardware Side
Programmable Data Communication Blocks
Example 18 Pulse Train Using Interrupts
SPI Protocol and Programming
Blackfin BF533 EZ-KIT Control The O in I/O
UNIT 26 SPI Test 로봇 SW 교육원 조용수.
Serial Peripheral Interface Bus
Presentation transcript:

Example 13 The Serial Peripheral Interface (SPI) Lecture L9.1

PIM_9DP256 Block Diagram 3 SPI Ports

SPI2 Pins PP4 – PP7 Pins 112,111,110,109 SPI1 Pins PP0 – PP3 Pins 4,3,2,1 SPI0 Pins PS4 – PS7 Pins 93,94,95,96

SPI2 Pins PP4 – PP7 Pins 112,111,110,109 SPI1 Pins PP0 – PP3 Pins 4,3,2,1 SPI0 Pins PS4 – PS7 Pins 93,94,95,96

Two SPI modules connected in a master-slave configuration

$D8

Connecting a 16 x 1 hex keypad to two 74165 shift registers

int read_16shift(void){ int data; char c; SS0_LO(); // latch data SS0_HI(); c = send_SPI0(0); // get 1st byte by sending dummy data data = c; data = data << 8; c = send_SPI0(0); // get 2nd byte by sending dummy data data = data | c; return data; }

char get_key(){ const char keytbl[] = { 0x3, 0x2, 0x1, 0x0, 0x8, 0x9, 0xA, 0xB, 0x7, 0x6, 0x5, 0x4, 0xC, 0xD, 0xE, 0xF }; int mask; int data; int i; char found; char key; data = read_16shift(); mask = 0x8000; found = 0; i = 0; key = 16; // not found if key = 16 while((i < 16) && (found == 0)){ if((data & mask) == 0){ found = 1; key = keytbl[i]; } else { mask >>= 1; i++; return key;

// Example 13: SPI Keypad Interfacing with 74165 Shift Registers #include <hidef.h> /* common defines and macros */ #include <mc9s12dp256.h> /* derivative information */ #include "main_asm.h" /* interface to the assembly module */ #pragma LINK_INFO DERIVATIVE "mc9s12dp256b" int read_16shift(void); char get_key(void); void main(void) { char key; PLL_init(); // set system clock frequency to 24 MHz lcd_init(); // enable lcd SPI0_init(); // enable SPI0 set_lcd_addr(0x40); while(1) { key = get_key(); if(key < 16){ key = hex2asc(key); // convert to ascii data8(key); // display on lcd }