Digital I/O Connecting to the Outside World

Slides:



Advertisements
Similar presentations
Sensing and Control.
Advertisements

Week10 Boolean Instructions on the Boolean Instructions  Boolean (or Bit) addressable capability is unique to the 8051  Enables efficient handling.
Sensors Interfacing.
Basic DC Motor Circuits
555 Timer ©Paul Godin Updated February Oscillators ◊We have looked at simple oscillator designs using an inverter, and had a brief look at crystal.
ACES PROGRAM Brad Ellison 28 January 2003 Basics of Interfacing to CanSat.
Intro to the Arduino Topics: The Arduino Digital IO Analog IO Serial Communication.
Digital Tachometer ENGR 4803 Electromechanical Systems & Mechatronics.
Dr. Andreas Kunz © 10/2004 inspire icvr BASICS OF ELECTRONICS.
Basic Stamp II is kinda cool Bytes of EEPROM(non-volatile) - Clock speed of 20 MHz. - Holds 600 lines of code in EEPROM - executes an average of.
Part A: Controlling Oscillation Frequency with Capacitors and Resistors Part B: Diodes and Light Experiment Timer.
Chapter 8 Output Modules.
GCSE Electronic Products
M.S.P.V.L. Polytechnic College, Pavoorchatram
Module 2: Hardware and Terminology
555 Timer ©Paul Godin Updated February Oscillators ◊We have looked at simple oscillator designs using an inverter, and had a brief look at crystal.
Microprocessor and Microcontroller Based Systems Instructor: Eng.Moayed N. EL Mobaied The Islamic University of Gaza Faculty of Engineering Electrical.
Engineering 1040: Mechanisms & Electric Circuits Fall 2011 Introduction to Embedded Systems.
RM2C Understanding Connections on the Robot Control Board (RCB).
Dean Brock, Rebecca Bruce and Susan Reiser, CCSC SE 2009 Using Arduino Material taken from Todbot blog Bionic Arduino Todbot blog Bionic ArduinoTodbot.
T IMERS - 2. O UTPUT U NIT Each capture/compare block contains an output unit. The output unit is used to generate output signals such as PWM signals.
Ch4 Electronic Components Circuit/Schematic Symbols.
LSU 06/04/2007Expanding the BASIC Stamp1 Expanding the BASIC Stamp: Useful peripherals Programming Unit, Lecture 6.
LSU 10/22/2004Serial I/O1 Programming Unit, Lecture 5.
Objectives How Microcontroller works
Segway Controller Notes. = connection on top layer of circuit board = connection on bottom layer of circuit board Ground Plane: Areas enclosed by the.
Rd 3 - Electronics 1.Ohm’s Law 2.Potential Divider 3.Resistor in Series and Parallel - Application of Ohm’s Law 4. Operational Amplifier (Comparator and.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
Practical Digital Design Considerations Part 1 Last Mod: January 2008 ©Paul R. Godin.
©2008 Pearson Education, Inc., Upper Saddle River, NJ. All rights reserved. This material is protected under all copyright laws as they currently exist.
MICRO CONTROLLER MODULE 1. Learning Objectives Name some gadgets that use microcontrollers. Define a microcontroller. Differentiate between a computer.
MCU: Interrupts and Timers Ganesh Pitchiah. What’s an MCU ?
One of the most important feature of the microcontroller is a number of input/output pins used for connection with peripherals. In the case of PIC 167CX,
PWM Circuit Based on the 555 Timer. Introduction In applications LED Brightness Control we may want to vary voltage given to it. Most often we use a variable.
Chapter 10 Advanced Programming, PLC Interfacing, and Troubleshooting
Electronic Components Circuit/Schematic Symbols. RESISTOR Resistors restrict the flow of electric current, for example a resistor is placed in series.
ME456: Mechatronics Systems Design Lecture 3 Chapter 2: Lights On –Lights Off Prof. Clark J. Radcliffe Mechanical Engineering Michigan State University.
Logic Functions and Symbols
Programmable Logic Controller (PLC)
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
Getting Started With the Arduino Uno
CSE Fall Introduction - 1 What’s Inside the Buffer? IhIh IlIl Write Reg This device always “drives” either high or low. Current is a function.
PRESENTATION ON THE TOPIC By: Rahul agarwal. INTRODUCTION  Overload protection circuit are required in inverters and uninterrupted power supplies to.
18240 Element two - Components INPUTS OUTPUTS PURPOSE TYPICAL USE.
Digital-to-Analog Analog-to-Digital Week 10. Data Handling Systems  Both data about the physical world and control signals sent to interact with the.
THEME 9: Multi-vibrators. Multi-vibrators in integral realization. Multi-vibrators (also called oscillators or pulse train generators) have two unstable.
MICROCONTROLLER INTERFACING WITH STEPPER MOTOR MADE BY: Pruthvirajsinh Jadeja ( ) COLLEGE:DIET BRANCH:EC.
Arduino Based DC Motor Speed Control
Pulse-Width Modulation: Simulating variable DC output
Lecture Notes / PPT UNIT III
TITLE: 555 Timer OM INSTITUTE OF TECHNOLOGY Subject: Analog Electronics ( ) Semester: 03 Prepared By:
Arduino Application: Speed control of small DC Motors
Components of Mechatronic Systems AUE 425 Week 2 Kerem ALTUN October 3, 2016.
Lesson 1 PLC BASICS. PLC Definition  Programmable Logic Controllers are industrial computers that control machine and other applications.  PLC have.
Application Case Study Christmas Lights Controller
SENSORS.
REMOTE JAMMING DEVICE.
For further information
Microprocessors Tutorial 1: Arduino Basics
555 Timer EEE DEPARTMENT KUMPAVAT HARPAL( )
EI205 Lecture 13 Dianguang Ma Fall 2008.
What’s Inside the Buffer?
Lesson 9: Digital Input-Output Signal Interfacing
PLC Hardware Components.
Discrete Versus Analog Devices
Basic Electronics Part Two: Electronic Components.
ACOE347 – Data Acquisition and Automation Systems
UNIT 11: RC-SERVOMOTOR CONTROL
Presentation transcript:

Digital I/O Connecting to the Outside World Programming Unit, Lecture 4 LSU 06/04/2007 Digital I/O

Digital I/O is an essential requirement for most micro-controller applications. Digital I/O: input/output of digital “on-off” bit or group of bits from the CPU to outside world. User interface controls. Configuration option switches. Activate indicators such as lamps or LEDs, sound alerts or alarms, control motors, solenoids, or valves. Read or monitor the state of external switches or sensors. Digital communication with other external IC’s or devices. LSU 06/04/2007 Digital I/O

BASIC Stamp has 16 I/O pins. Labeled P0 thru P15. Referenced as pin n in software, where n can be 0 to 15. Bi-directional, can be defined in software as inputs or outputs with the INPUT and OUTPUT instructions. LSU 06/04/2007 Digital I/O

1 For example, INPUT pin5 defines logical pin5 (or P5) as an output pin. Note that P5 corresponds to physical pin 10 on the actual BASIC Stamp IC. Be sure not confuse logical pins with physical pins. LSU 06/04/2007 Digital I/O

Digital I/O pins can be used for connection to external circuits or devices but care must be exercised to avoid damaging or destroying the BASIC Stamp IC. Observe Electrostatic Discharge precautions, particularly when the BASIC Stamp is not installed on a circuit board or the I/O pins are unconnected (“floating”). Never connect the pins to voltages outside the range of 0 to 5 volts. Observe polarities! LSU 06/04/2007 Digital I/O

Pull Up and Pull Down Resistors BASIC Stamp I/O pins defined as inputs have high-impedance. Pins can be in an unpredictable HIGH or LOW state when charged are discharged by leakage paths on the printed circuit board. Many misbehaving CMOS circuits or micro-controller programs can be traced to unconnected input pins. All inputs should be properly terminated with a high value resistor to either VCC (a pull up) or GND (pull down). Termination to VCC with a pull up resistor is usually the preferred method. LSU 06/04/2007 Digital I/O

Pull Up and Pull Down Resistors The resistance value for pullup resistors is not usually critical. 10k ohms is common but can be from 1k to 100k ohms. With VCC=5V and a pullup resistor of 10k, the maximum current is 500 microamperes or 0.5 ma. BalloonSat has 10k pullup resistors installed (10-pin SIP). LSU 06/04/2007 Digital I/O

Digital Output Set the I/O direction for output with the OUTPUT pin instruction. A pin configured as an output can be set to a logical high or low state with the HIGH pin or LOW pin instructions. A logical LOW is nominally 0 volts. This state is also called L, 0, off, reset or clear A logical HIGH is nominally 5 volts. This state is also called H, 1, on, set or asserted. I/O pins are limited in their current sinking and sourcing ability. LSU 06/04/2007 Digital I/O

I/O Pin as a Current Source When pin is HIGH, current flows from the pin through the load to GND. When pin is LOW, no potential difference between pin and GND, no current flows. The instruction HIGH pin would activate the load. The instruction LOW pin turns the load off. The current limiting resistor may be needed in some applications. LSU 06/04/2007 Digital I/O

I/O Pin as a Current Sink When pin is LOW, current flows from the +5V power supply through the load to I/O pin. When pin is HIGH, no potential difference between pin and +5V, no current flows. The instruction LOW pin would activate the load. The instruction HIGH pin turns the load off. The current limiting resistor may be needed in some applications. LSU 06/04/2007 Digital I/O

Digital Output Applications Driving an LED with I/O pin as a current source. Driving an LED with I/O pin as a current sink. LOW pin turns LED on. HIGH pin turns LED on. Resistor R limit is chosen to limit current to a safe and appropriate value for the BASIC Stamp IC and the LED. LSU 06/04/2007 Digital I/O

Digital Output Applications The BASIC Stamp I/O pins have limited current sink and source capability. The pin’s safe voltage limits are 0 to +5V. I/O pins can safely sink or source about 20 mA of current. For applications requiring higher voltage or current, external buffering is required. The BASIC Stamp can be used to drive bipolar transistors, FETs or solid state or electromechanical relays which in turn can control high current or high voltage circuits. LSU 06/04/2007 Digital I/O

Digital Output Applications Buffered Digital I/O Examples LSU 06/04/2007 Digital I/O

Digital Input This will work but there is a better way! Set the I/O direction for output with the INPUT pin instruction. A variable assigned to the I/O pin will take on a value reflecting the voltage level at the pin. This will work but there is a better way! LSU 06/04/2007 Digital I/O

Digital I/O: reading a switch Common Switch Types: Normally Open (NO) Normally Closed (NC) Toggle Momentary (Pushbutton) Rotary Mechanical switches are not perfect and may exhibit contact bounce as the switch is operated. Typically on the time scale of milliseconds. LSU 06/04/2007 Digital I/O

Input Interfacing of Electronics to BASIC Stamp LSU 06/04/2007 Digital I/O

Analog I/O with the BASIC Stamp The BASIC Stamp’s I/O pins are digital and can only be on or off. The Stamp has no direct ability to read or generate analog voltage levels. Additional hardware can be added at a price: $’s and complexity. Analog-to-Digital Converters (ADC) Digital-to-Analog Converters (DAC) For simple analog input or output applications, the digital I/O pins and the technique of pulse-width modulation (PWM) can “fake” analog I/O. LSU 06/04/2007 Digital I/O

Analog Output using PWM A simple Digital-to-Analog Converter can be built with an RC network and a single instruction on the BASIC Stamp. The I/O pin can only be High (+5V) or Low (0 volts) but the RC network will “average” a train pulses to generate an analog voltage. The PWM instruction is a built-in command to send pulses to the RC network. Format of the command is PWM pin, Duty, Duration LSU 06/04/2007 Digital I/O

Pin selects the desired I/O pin. Duty (duty cycle) specifies the ratio of the high pulse duration to the duration of all pulses in a specified interval of time. Duration specifies the duration of the PWM pulse train. Duty is on a scale of 0 to 255, corresponding to 0 to 5 volts. If we wanted an analog voltage output of 2.5 volts, duty = 255 x 2.5 / 5 duty = 127.5 which we round to the integer 128. The required Duration is about 5 time-constants of the RC network, Duration = 5 x 10K x 1 uF Duration = 0.05 sec or 50 milliseconds LSU 06/04/2007 Digital I/O

The PWM technique is inexpensive and quick to implement but it suffers from limited resolution and cannot supply any significant current to a load. An external buffer using an operational amplifier (Opamp) can be used to improve performance. LSU 06/04/2007 Digital I/O

Analog Input using PWM The BASIC Stamp has no capability for directly reading analog quantities but it does have a specialized instruction RCTIME which allows determining a resistance or capacitance value by measuring the time it takes to charge or discharge an RC network. The I/O pin is set to +5v, charging capacitor C. The pin is then changed to an input and a counter measures the time to discharge C through R. The 220 ohm resistor limits current from the I/O pin to a safe value. Circuit for measuring discharge time. LSU 06/04/2007 Digital I/O

Analog Input using PWM The syntax for using RCTIME is RCTIME pin, state, variable pin is the selected I/O pin state specifies the state of pin for the measurement 0 sets pin to 0v or logical Low initially (measure charge time) 1 set pin to 5v or logical High initially (measure discharge time) variable is the name of a variable into which the counter is stored See the PBASIC Help file for additional details. LSU 06/04/2007 Digital I/O