ECE 372 Microcontroller Design

Similar documents
Chapter 9. Input/Output (I/O) Ports and Interfacing. Updated: 3/13/12

Input/Output Ports and Interfacing

Mechatronics and Measurement. Lecturer:Dung-An Wang Lecture 6

PIC DESIGN (version 1) 2/11/2009

MicroProcessor. MicroProcessor. MicroProcessor. MicroProcessor

ECE 485/585 Microprocessor System Design


UNIT 3 THE 8051-REAL WORLD INTERFACING

ECE 2300 Digital Logic & Computer Organization

SANKALCHAND PATEL COLLEGE OF ENGINEERING, VISNAGAR. ELECTRONICS & COMMUNICATION DEPARTMENT Question Bank- 1

Read and Write Cycles

Pmod modules are powered by the host via the interface s power and ground pins.

Bachelor of Engineering in Computer and Electronic Engineering

William Sandqvist

MK5 5-Axis Controller

PICado Alpha Development Board V1.0

NeoLoch. Inquisitor 6821 PIA Blade Manual. Overview. Preliminary Release

CHAPTER 5. Voltage Regulator

MC74C Digit BCD Display Controller/Driver. General Description. Ordering Code: Connection Diagram. Features. Version 1.0

Logic Chip Tester User Manual SW Version /8/2012. Chapter 1 Introduction/Background

A PIC-based LCD Display for Stand-Alone Instrumentation

RTC Interface 89C51 DS M. Krishna Kumar MAM/M7/LU17/V1/ Vcc VCC 5 SDA P1.0 6 SCL P KHz 3 BAT 3.

Column decoder using PTL for memory

Laboratory 10. Programming a PIC Microcontroller - Part II

EMBEDDED SYSTEMS COURSE CURRICULUM

Lecture (04) PIC 16F84A programming I

LABORATORY MANUAL Interfacing LCD 16x2, Keypad 4x4 and 7Segment Display to PIC18F4580

Axiom Manufacturing. Users Manual. for PROJECT DEVELOPMENT BOARD AXM xiom anufacturing

C and Embedded Systems. So Why Learn Assembly Language? C Compilation. PICC Lite C Compiler. PICC Lite C Optimization Results (Lab #13)

POWER SAVER METER USING MICROCONTROLLER TO SAVE ELECTRICITY UPTO 30-40%

GL116 ENCODER/DECODER MANUAL GLOLAB CORPORATION

USB-Based 20-Channel Data-Acquisition Module

MAHALAKSHMI ENGINEERING COLLEGE TIRUCHIRAPALLI UNIT IV I/O INTERFACING PART A (2 Marks)

Memory & Simple I/O Interfacing

A4988 Stepper Motor Driver Carrier with Voltage Regulators

Lecture 5: Computing Platforms. Asbjørn Djupdal ARM Norway, IDI NTNU 2013 TDT

1 Overview. Standard Products Application Note 8-bit MSI & 16-bit Logic Products with Unused or Floating Logic Inputs

INTRO TO I/O INTERFACE

RT54SX T r / T f Experiment

MP5013A 5 V, 5 A Programmable Current-Limit Switch with Over-Voltage Clamp and Slew-Rate Control in TSOT23-8

Course Introduction. Content: 21 pages 4 questions. Learning Time: 35 minutes

Lab3: I/O Port Expansion

Application of PIC Microcontroller for Controlling Piezoelectric Braille Cell

Turning Ideas Into Reality ABCircuits POB 123 New Hill NC (919) C922-SO IC

UNIT V MICRO CONTROLLER PROGRAMMING & APPLICATIONS TWO MARKS. 3.Give any two differences between microprocessor and micro controller.

PICmicro Microcontroller Lite programmer datasheet

A4988 Stepper Motor Driver Carrier

PIC Microcontroller Introduction

PROGRAMMABLE POWER SUPPLY

Ensuring Power Supply Sequencing in Spaceflight Systems

A4988 Stepper Motor Driver Carrier, Black Edition

Silicon Steroids for the Stamp Help Your Projects Heft Big Loads Using Switching Transistors

MICROPROCESSORS & INTERFACING (A1423) C.Lokanath Reddy Assistant Professor.

IS-S0108 Single Switch Solution

ECE 354 Computer Systems Lab II. Memory and Indirect Addressing

Lab #2: Building the System

Lecture (02) PIC16F84 (I)

Module 12: Elementary Input/Output

Lab 16: Data Busses, Tri-State Outputs and Memory

8:1 Serial Port Expander

Introduction. Embedded system functionality aspects. Processing. Storage. Communication. Transformation of data Implemented using processors

Fully Integrated Thermal Accelerometer MXC6225XU

Digital IO PAD Overview and Calibration Scheme

PROGRAMMING AND CUSTOMIZING

USER S MANUAL. C11- MULTIFUNTCION CNC BOARD Rev. 9.9

Device: LDP This document Version: 1.0. Date: July Description: 80x08 1R1G LED Display Panel

MICROPROCESSOR RELAY FOR PROTECTION OF ELECTRICAL SYSTEMS

DHANALAKSHMI COLLEGE OF ENGINEERING DEPARTMENT OF ELECTRICAL AND ELECTRONICS ENGINEERING YEAR : III SEM : VI

CS152 Computer Architecture and Engineering Lecture 16: Memory System

GUIDE TO SP STARTER SHIELD (V3.0)

eip-24/100 Embedded TCP/IP 10/100-BaseT Network Module Features Description Applications

BUILDING BLOCKS OF A BASIC MICROPROCESSOR. Part 1 PowerPoint Format of Lecture 3 of Book

SH69P55A EVB. Application Note for SH69P55A EVB SH69P55A EVB SH69V55A

Address connections Data connections Selection connections

Spiral 2-9. Tri-State Gates Memories DMA

Physical Computing Self-Quiz

The PICAXE VSM Tutorial is split into a number of chapters. Each chapter can be downloaded free of charge from the website.

INDUSTRIAL TRAINING:6 MONTHS PROGRAM TEVATRON TECHNOLOGIES PVT LTD

MP5013E 5V, 2A, Programmable Current- Limit Switch with Over-Voltage Clamp and Slew Rate Control in a TSOT23-8

Advance Robotics with Embedded System Design (ARESD)

Lab3: I/O Port Expansion

CpE 442. Memory System

Prototyping Module Datasheet

Homework 5: Theory of Operation and Hardware Design Narrative

MP6500 Stepper Motor Driver, Digital Current Control

Appendix B. Following is a list of topics in this section:

The FED PIC Flex 2 Development Boards

Configuring APEX 20K, FLEX 10K & FLEX 6000 Devices

CSE 466 Exam 1 Winter, 2010

Hello, and welcome to this presentation of the STM32 Touch Sensing Controller (TSC) which enables the designer to simply add touch sensing

FM24C Kb FRAM Serial Memory Features

Section 30. I/O Ports with Peripheral Pin Select

7 8 9 C. PRELAB REQUIREMENTS You must adhere to the Lab Rules and Policies document for every lab.

COMP2121: Microprocessors and Interfacing. I/O Devices (II)

Texas Instruments Microcontroller HOW-TO GUIDE Interfacing Keypad with MSP430F5529

NeoLoch. Inquisitor Static RAM 1 Blade V3 Manual. Overview

Analog Devices Welcomes Hittite Microwave Corporation NO CONTENT ON THE ATTACHED DOCUMENT HAS CHANGED

Intel Quark SE Microcontroller C1000 Power Sequencing Considerations

ElectronFlux USB Module

Appendix F: Design Documentation for multisensory therapy system

Transcription:

!! "! E.g. Port A, Port B "! Used to interface with many devices!! Switches!! LEDs!! LCD!! Keypads!! Relays!! Stepper Motors "! Interface with digital IO requires us to connect the devices correctly and write code to interface with the devices 2

!! Where can we connect external hardware? "! Unused ports (most ports has digital IO functionality) "! Expand through the serial interface!! SPI serial peripheral interface!! UART!! I 2 C "! External Components to Expand IO Ports 3!! Where can we connect external hardware? "! 6-bit 28-pin Starter Board!! Port B (RB0 RB5)!! Port A (RA0, R, R)!! RB0, RB, RB4, and R can only be used on stand-alone programming "! Corresponds to pins 4, 5,, and 2 4 2

!! Digital Inputs "! What does the following circuit do? MCLR (Reset) Switch Schematic from 6-bit 28-pin Starter Board "! Note: MCLR is an active low signal.!! Active low signals are asserted if the input is low (0)!! For PICs, if the MCLR input is 0 the PIC is reset 5!! Used for Hardware De-Bouncing of Switch Input "! Resistor connected to Vdd is used to Pull-Up the input pin to a logical high!! Vdd is 3.3V for!! Logic high () will be seen when button is not pressed!! Logic high () will be seen when button is not pressed "! Pressing switch creates conduction path to ground "! Without capacitor, simple switches exhibit bouncing 6 3

!! Used for Hardware De-Bouncing of Switch Input Analog Voltage at Input Pin: Digital Value Read by PIC: Bouncing 7!! Charging and discharging of capacitor reduces bouncing behavior Analog Voltage at Input Pin: Digital Value Read by PIC: No Bouncing 8 4

!! When is a digital input a logic high () versus logic low (0) "! Depends on voltage standard used by the digital device "! Lots of standards exist Logic High!! () "! Logic Low Input: < 0.2 Vdd (0.66V) "! Logic High Input: > 0.8 Vdd (2.64V) "! What about between 0.2 and.8 Vdd?!! All digital inputs have Schmitt Triggers Logic Low (0) Vdd.8 Vdd.2 Vdd 0 V 9!! Schmitt Trigger "! Removes hysteresis between transition from low to high and high to low "! Helps in de-bouncing digital inputs (but does not solve it on its own) Analog Voltage at Input Pin:.8 Vdd Logic High () Vdd.8 Vdd.2 Vdd 0 V Digital Value Read by PIC with Schmitt Trigger: Logic Low (0).2 Vdd 0 V 0 0 5

!! Software De-bouncing "! De-bouncing can be done in software using timed waits "! Simplifies external hardware needs "! Pseudocode for software de-bounce for button press // wait for button press while (switch == ); // delay for 5 to 0 ms for (i=0; i<some_larger_number; i++); "! Bad example of software de-bounce as timing using for loops is imprecise.!! Is there a better way?!! Directly Controlling LEDs "! can directly control LED from output ports!! Write 0 to port: Turns LED on!! Write to port: Turns LED off Vdd LEDs schematic from 6-bit 28-pin Starter Board 2 6

!! Directly Controlling LEDs "! How much current is drawn by IO?!! I = V / R = 3.3 / 475 = 6.9 ma "! How much current can be drawn by the PIC s IO pin?!! Check the datasheet (pg.229, Electrical Characteristics)!! 25 ma for "! How much current can be drawn by ALL IO pins of the PIC?!! Check the datasheet!! 200 ma LEDs schematic from 6-bit 28-pin Starter Board 3!! Configure IO Pins for "! Each IO Port has at least three registers!! TRIS : Controls tri-state driver for direction ( -> Input, 0 -> Output)!! LAT : Output latch for writing value to the port (or reading current value assigned to port)!! PORT : Value read directly from the port "! Additional Registers Needed for Some IOs!! CNPU : Enables weak internal pull-up resistor!! ADPCFG : Configures ports as analog or digital!! ODC : Enables open drain collector configuration 4 7

!! Directly Controlling LEDs "! What if we need to to control a 5V digital output?!! Can use the Open-Drain Collector configuration for the digital outputs!! ODC registers control configuration ( -> open drain configuration)!! Using open drain configuration, write a logical 0 to the LAT register will enable the open drain, producing a 0V at the output pin "! No software changes are needed if you switch from the normal digital IO to the open drain configuration 5V!! Use NPN transistor as digital switch "! NPN in On if base is high () "! Still limited to current limit of digital IO pin output 5!! Directly Controlling LEDs "! Brightness of LED can be controlled by controlling the current "! LEDs also have maximum current draw (exceeding this will destroy the LED) "! Using open collector, what is the smallest value resistor can we use:!! R = 5V / 25 ma = 200!! With 330 : I = 5V / 330 = 5 ma 5V output 6 8

!! Directly Controlling LEDs "! We can use external IC to drive the LEDs!! Reduce current driven by microcontroller and protects it "! 74LS244IC Tri-state Buffer/Line Driver/Line Receiver!! Used to provide power for LEDs!! Has OE signals that can be used to disable the output OE OE2 74LS244 7!! Directly Controlling LEDs "! Limitation - Can only drive as many LEDs as available pins "! Solutions:!! Latching!! Scanning!! Multiplexing OE OE2 74LS244 8 9

!! LEDs - Latching "! Control LED by using a latch hardware "! Use additional hardware to control when to latch values!! Similar to memory mapped IO LED Address LED Data OE LE OE LE Latch Latch Address=0 Address= 9!! LEDs - Latching "! Control LED by using a latch hardware "! Use additional hardware to control when to latch values!! Similar to memory mapped IO Always writing last LED value! Any problems?? Microcontroller Addr OE LE OE LE Latch Latch Address=0 Address= 20 0

!! LEDs - Latching "! Add enable signal from microcontroller What did we build? Is there another way to implement the address decoding? En Addr OE LE OE LE Latch Latch Address=0 Address= 2!! LEDs - Latching "! Use decoder for addressing LED banks!! Decoder - Converts input binary number to single high output "! 2-input decoder: four possible input binary numbers!! Thus, four outputs, one for each possible input binary number "! Enable signal!! Outputs all 0 if e=0!! Regular behavior if e= i i0 d0 i i0 d ii0 d2 i0 i e d0 d d2 d3 ii0 d3 i i0 22

!! LEDs - Latching "! Use decoder for addressing LED banks En Addr en d0 i0 d x2 Decoder OE LE OE LE Latch Latch Address=0 Address= 23!! LEDs - Scanning "! Use software executing on the microcontroller to control LEDs row by row, col by col, or bank by bank (depending on organization) "! Operation!! Continually scan LEDs fast enough that human eye cannot detect it "! Similar to refresh rate of TVs and Monitors!! Enable one column of LEDs by writing 0 to output port controlling desired column!! Write LEDs value for select row!! LEDs Multiplexed "! Similar to scanning but uses decoders to specify the row and columsn!! Continually scan LEDs fast enough that human eye cannot detect it "! Similar to refresh rate of TVs and Monitors!! Enable LED column by outputting column address to column decoder!! Enable individual LEDs by outputting row address to row decoder "! Cannot access all LEDs simultaneously 24 2

!! How many LEDs can I control using only eight output pins using the following schemes? "! Latched: "! Scanned "! Multiplexed: 25!! How many LEDs can I control using only eight output pins using the following schemes? "! Latched:!! 64 LEDs Individual latch used for each LED!! Enable Output, 6 Address Lines, and Data Line!! Six address lines allow for access to 2 6 latches (or LEDs) "! Scanned!! 6 LEDs 4 columns by 4 rows "! Multiplexed:!! 256 LEDs 6 columns by 6 rows!! Enabled by using 4x6 decoder to select both row and columns 26 3

!! Mill Game "! How many pins do we need to connect the 48 LEDs in the following diagram? 27!! Mill Game 28 4

!! 7-Segment LEDs "! Can directly control all seven segments using PIC IOs "! Or, driver IC can be used to control display using fewer pins!! 4 pins instead of 7pins!! Typically uses BCD to represent displayed value 29!! Keypads "! Collection of several keys grouped into a single device!! Can buy keypads in many different configurations!! Build your own keypad using individual buttons "! How can we read dozens of keys on the keypad without requiring dozens on individual input ports on our microprocessor?!! Hint: It s similar to how we can interface with dozens of outputs using only a few pins 30 5

!! Keypad Scanning "! Similar to scanning for controlling multiple output LEDs "! Scan the keys one row at a time and read the column lines to see if any key on that row were pressed row 0 row row 2 row 3 col 0 col col 2 col 3 3!! Keypad Scanning "! Similar to scanning for controlling multiple output LEDs "! Scan the keys one row at a time and read the column lines to see if any key on that row were pressed row 0 row row 2 row 3 col 0 col col 2 col 3 32 6

!! Keypad Scanning "! Similar to scanning for controlling multiple output LEDs "! Scan the keys one row at a time and read the column lines to see if any key on that row were pressed 0 row 0 row row 2. Set each row output sequentially to output 0 row 3 col 0 col col 2 col 3 2. Check column inputs to see if key was pressed What if this key is pressed? 33!! Keypad Scanning "! Similar to scanning for controlling multiple output LEDs "! Scan the keys one row at a time and read the column lines to see if any key on that row were pressed 0 0 row 0 row row 2. Set each row output sequentially to output 0 row 3 col 0 col col 2 col 3 2. Check column inputs to see if key was pressed What if this key is pressed? 34 7

!! Keypad Scanning "! Can you detect if more than one key is pressed? "! How do you detect if no keys are pressed? row 0 row row 2 row 3 col 0 col col 2 col 3 35!! Mill Game 36 8

!! Mill Game 8 Columns 3 Rows 37 9