SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.

Slides:



Advertisements
Similar presentations
Chapter 13 Shift Registers
Advertisements

Anurag Dwivedi Rudra Pratap Suman. Scope of Communica tion Telephones and Cell Phones.
EXTERNAL COMMUNICATIONS DESIGNING AN EXTERNAL 3 BYTE INTERFACE Mark Neil - Microprocessor Course 1 External Memory & I/O.
ECE 371 Unit 13 - Part 1 Serial Peripheral Interface (SPI)
LOGIC GATES ADDERS FLIP-FLOPS REGISTERS Digital Electronics Mark Neil - Microprocessor Course 1.
Sequential Circuits A Basic sequential circuit is nothing but a combinational circuit with some feedback paths between its output and input terminals.
Bits and Bytes + Controlling 8 LED with 3 Pins Binary Counting and Shift Registers.
Shift Register Application Chapter 22 Subject: Digital System Year: 2009.
Mark Neil - Microprocessor Course 1 Digital to Analog Converters.
HD44780 LCD programming From the Hardware Side Design and implementation details on the way to a valid SPI-LCD interface driver.
Serial Peripheral Interface (SPI)
7-1 Digital Serial Input/Output Two basic approaches  Synchronous shared common clock signal all devices synchronised with the shared clock signal data.
ENGIN112 L26: Shift Registers November 3, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 26 Shift Registers.
Interface circuits I/O interface consists of the circuitry required to connect an I/O device to a computer bus. Side of the interface which connects to.
A.Abhari CPS2131 Registers A register is a group of n flip-flops each of them capable of storing one bit of information There are two types of registers:
Digital Fundamentals Floyd Chapter 9 Tenth Edition
SEQUENTIAL CIRCUITS USING TTL 74XX ICS
1 Sequential Circuits Registers and Counters. 2 Master Slave Flip Flops.
Registers and Counters
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.
Serial Peripheral Interface Module MTT M SERIAL PERIPHERAL INTERFACE (SPI)
HD44780 LCD programming From the Hardware Side
LSU 10/22/2004Serial I/O1 Programming Unit, Lecture 5.
4.0 rtos implementation part II
1 Registers and Counters A register consists of a group of flip-flops and gates that affect their transition. An n-bit register consists of n-bit flip-flops.
Rabie A. Ramadan Lecture 3
Dr. Rabie A. Ramadan Al-Azhar University Lecture 6
Lecture 20: Communications Lecturers: Professor John Devlin Mr Robert Ross.
CENT-113 Digital Electronics 1 Flip Flops TI Type 502 Flip Flop: 1st production IC in 1960.
SEQUENTIAL CIRCUITS Component Design and Use. Register with Parallel Load  Register: Group of Flip-Flops  Ex: D Flip-Flops  Holds a Word of Data 
 8251A is a USART (Universal Synchronous Asynchronous Receiver Transmitter) for serial data communication.  Programmable peripheral designed for synchronous.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Lecture 17 Dr. Shi Dept. of Electrical and Computer Engineering.
ENG241 Digital Design Week #8 Registers and Counters.
Computer Organization & Programming Chapter 5 Synchronous Components.
Registers Page 1. Page 2 What is a Register?  A Register is a collection of flip-flops with some common function or characteristic  Control signals.
Abdullah Said Alkalbani University of Buraimi
OCRP RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
Sequential logic circuits
Chapter 10 Flip-Flops and Registers 1. Objectives You should be able to: Explain the internal circuit operation of S-R and gated S-R flip-flops. Explain.
OCRP RF Control WINLAB – Rutgers University Date : June Authors : Prasanthi Maddala, Khanh Le,
Essentials of Communication This simple model requires many guarantees. Sender Receiver Communication Link Data.
Revised: Aug 1, ECE263 Embedded System Design Lessons 27, 28 Serial Peripheral Interface.
Department of Electronic & Electrical Engineering Serial interfaces Serial Interfaces allow communication between devices sending one bit at a time. In.
Serial Peripheral Interface SPI I2C (i-squared cee)
D Flip Flop. Also called: Delay FF Data FF D-type Latches ‘Delayed 1 Clock Pulse’
SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers.
Mark Neil - Microprocessor Course 1 Digital to Analog Converters.
REGISTER TRANSFER LANGUAGE (RTL) INTRODUCTION TO REGISTER Registers1.
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN Dr. Shi Dept. of Electrical and Computer Engineering.
Modular sequential logic Use latches, flip-flops and combinational logic –Flip-flops usually grouped to form a register Shift registers –n bits {x n …x.
BIRLA VISHVAKARMA MAHAVIDYALAY SUBJECT: SPI PROTOCOL & MAX7221 DISPLAY INTERFACING SUBMITTED BY: KISHAN AVASTHI( ) MANSI CHANDEGARA( )
1 Registers A register is a group of n flip-flops each of them capable of storing one bit of information There are two types of registers: parallel and.
MICROCONTROLLER AND INTERFACING Presented by: Shefali Jethva ( ) Shivali Panchal ( ) Komal Soni ( ) Roll no. :- 14EC308.
©F.M. Rietti Communication Lines Fundamentals. ©F.M. Rietti LM-18 Computer Science SSI Embedded Systems I 2 Communication Lines Generally used to connect.
Class Exercise 1B.
REGISTER TRANSFER LANGUAGE (RTL)
Electronics Technology
Diagram of microprocessor interface with IO devices
Sequential Logic Counters and Registers
Basics of digital systems
INTRODUCTION Overview of Shift Registers
Atmega32 Serial Programming Basics
Pulse Width Modulation (PWM)
COE 202: Digital Logic Design Sequential Circuits Part 4
Serial Communication Interface: Using 8251
Serial versus Parallel Data Transfers
ECEN 248: INTRODUCTION TO DIGITAL SYSTEMS DESIGN
SPI Protocol Sepehr Naimi
HD44780 LCD programming From the Hardware Side
14 Digital Systems.
Presentation transcript:

SHIFT REGISTERS: CONVERTING BETWEEN SERIAL AND PARALLEL DATA Mark Neil - Microprocessor Course 1 Serial versus Parallel Data Transfers

Serial communications Mark Neil - Microprocessor Course 2 Most communications is carried out over serial links  Fewer wires needed  Less electronics needed  Must run faster Examples  Ethernet  USB – Universal Serial Bus  USART – Universal Synchronous and Asynchronous serial Receiver and Transmitter (RS232/COM ports)  I 2 C – Inter Integrated Circuit  SPI – Serial Peripheral Interface All available in ATmega128 as “on- chip peripherals”

Shift Registers Mark Neil - Microprocessor Course 3 Shift Registers convert numbers expressed in terms of several bits (many signal lines) into a stream of 0s, 1s and a Clock.  Advantage: A convenient way to reduce the number of Electrical signal lines by factors of 8, 16, 32, 64.  Disadvantage: For the same transfer rate the electronics must be faster by factors of 8, 16, 32, 64.

A Four Bit Shift Register Composed of 4 D-Flip-Flops Parallel to Serial Conversion This Shift Register converts data on a 4 bit parallel data bus into a serial bit stream When Parallel load is set, the S/R bits on the Flip Flops are arranged to latch in the bits on the data bus (1 bit on each Flip Flop) On each rising edge of the clock, The Data on the Flip Flops is put on the Q (Output Line), which appears at the input of the next flip flop. The input data is latched, and the bits move from one FF to the next It takes 4 clock cycles to move the 4 bits out to the serial ouput line Mark Neil - Microprocessor Course 4

Data is placed on the parallel data bus PL: Data Loaded into Flip Flops On Clock edge Data is shifted from output of each FF to the Input of the next NEILNEIL - Microprocessor Course 5

8 Bit Parallel to Serial Shift Register Mark Neil - Microprocessor Course 6

Parallel to Serial Conversion: Parallel load a number then clock it out Mark Neil - Microprocessor Course 7

Serial to Parallel shift register At each clock transition, the data is shifted to the next flip-flop in the chain We need to keep track of how many clock pulses we have sent to know when the full byte is on the outputs Mark Neil - Microprocessor Course 8

Suppose you feed a ‘1’: Mark Neil - Microprocessor Course 9

The 74HC164 Shift Register: Serial to Parallel Mark Neil - Microprocessor Course 10 Serial Data In Serial Data In *Reset Parallel out Parallel out Clock

74HC164 Function Table Mark Neil - Microprocessor Course 11

Serial/parallel peripheral module on AVR There are Several different peripheral functional units on the AVR which you can use. The Serial Peripheral Interface (SPI) unit allows the AVR to communicate to external devices using a simple serial protocol. M. Neil - Microprocessor Course 12

SPI module on AVR At the heart of the SPI module is a shift register. You can write parallel 8-bit data to the SPI module which is then automatically clocked out through the shift register to external pins. The SPI unit can also read in serial data from external pins and present it as parallel 8- bit data to your program. M. Neil - Microprocessor Course 13

SPI timing diagram Mark Neil - Microprocessor Course 14 Note that as well as selecting clock polarity, you can also select whether the MSB or the LSB is output first!

SPI code example Mark Neil - Microprocessor Course 15 SPI_MasterInit: ; Set MOSI and SCK output, SS* also as output, all others input ldi r17,(1<<DDB2)|(1<<DDB1)|(1<<DDB0) out DDRB,r17 ; Enable SPI, Master, set clock rate fck/16 ldi r17,(1<<SPE)|(1<<MSTR)|(1<<SPR0) out SPCR,r17 ret SPI_MasterTransmit: ; Start transmission of data (held in r16) out SPDR,r16 Wait_Transmit: ; Wait for transmission to complete sbis SPSR,SPIF rjmp Wait_Transmit ret

High Level Design Mark Neil - Microprocessor Course 16 The Project: 8-bit Serial Data ATmega128 Parallel To Serial PORTB Data Clock SPI Shift Register 74HC164 Shift Register 74HC164 8-Bits of data (Parallel) Serial to Parallel Serial to Parallel 8-Bits of data (Serial) 8-Bits of data (Parallel) LEDs

Low Level Design Wire up LEDs so that you can see the data arrive on the output Wire up a switch to the MR* line to allow you to clear the Shift Register outputs (make sure you understand how this works) The clock and data bits should come from PORTB 17 Mark Neil - Microprocessor Course Data: PORTB2 (MOSI) Clock: PORTB1 (SCK)

The Serial Link Test Program Mark Neil - Microprocessor Course 18 Start Delay several seconds Delay several seconds Send new pattern to SPI SPI Clocks the data 8 times into 164 using PORTB SPI Clocks the data 8 times into 164 using PORTB Look at the LEDs Look at the LEDs

Task Plan: Mark Neil - Microprocessor Course 19 Construct a device that will turn 8-bit parallel data into serial data + clock using the on-chip SPI peripheral. Construct a device that will receive serial data, convert them to parallel data and display them using LEDs. Write a program that will send several patterns down your ‘serial link’ and demonstrate that it works.