ENGR 355 Take Home Lecture 2 WRITING CODE Introductory Comments /* Disgruntled Avians Lab 6 ENGR355 by Tim Kyle Rev 01.45 1/1/2014 LM-3551 Tilt Sensor.

Slides:



Advertisements
Similar presentations
EMS1EP Lecture 6 Digital Inputs
Advertisements

1 ECE 372 – Microcontroller Design Parallel IO Ports - Outputs Parallel IO Ports E.g. Port T, Port AD Used to interface with many devices Switches LEDs.
Week10 Boolean Instructions on the Boolean Instructions  Boolean (or Bit) addressable capability is unique to the 8051  Enables efficient handling.
Introduction to Micro-controllers Anurag Dwivedi.
LECTURE 4 DIODE LED ZENER DIODE DIODE LOGIC
Input/Output (I/O) Ports and Interfacing
Engineering 4862 Microprocessors Lecture 23 Cheng Li EN-4012
In this presentation you will:
Microprocessor Motor Control Spring Introduction  Stamp projects Robots  Sensors  Motor control  Logic Rocketry  Reading acceleration (“g”
1 Boe-Bot Parts BOE-BOT Lecture #1b DE - Digital Electronics.
Getting the O in I/O to work on a typical microcontroller Ideas of how to send output signals to the radio controlled car. The theory behind the LED controller.
ECE 265 – LECTURE 13 Interface to switches and LEDs 7/3/ ECE265.
Lab 6 :Digital Display Decoder: 7 Segment LED display Slide #2 Slide #3 Slide #4 Slide #5 Slide #6 Slide #7 Display Decoder Fundamentals LT Control Input.
Digital Outputs 7-Segment Display
Discovery Lab School of Computing & Information System Florida International University.
Digital I/O Connecting to the Outside World
Lecture – 7 Basic input and output
ECE 447 Fall 2009 Lecture 6: TI MSP430 IO Interfacing.
ECE 447: Lecture 6 Input/Output Interfacing LEDs, Button Switches & Port Multiplexing.
BASIC ELECTRONICS.
Introduction to Arduino Prepared by R. Lamond.  “Arduino is an open-source electronics prototyping platform based on flexible, easy- to-use hardware.
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.
Edited by Mandar More Technical Manager, Ninad`s Research lab Ninad243.weebly.com MODERN OFFICE MANAGEMENT TOOL FOR SELECTIVE DATA.
Working with Arduino: Lesson #1: Getting Acquainted with the Kit EGN1007.
Microprocessor Block Diagram
Revised: Aug 1, EE4390 Microprocessors Lessons 29, 30 Welcome to the Real World!
Objectives How Microcontroller works
Input Laboratory: GPIO Pin control needed to have the Blackfin accept your commands Re-uses information from ENEL353 and ENCM369 courses and text books.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
3-1 Digital I/O A group of I/O pins is called a PORT  A port is where data enters/leaves the system. Digital I/O pins are usually grouped into 8,16 or.
I/O devices Peripheral devices (also called I/O devices) are pieces of equipment that exchange data with a CPU Examples: switches, LED, CRT, printers,
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
SE3910 Week 2, Class 1 Today Basic Circuits Other ??? Tomorrow Lab 2, S365 (Complete prelab BEFORE) Thursday See ScheduleSchedule SE-2811 Slide design:
Microprocessors A practical approach Subjects Goals for this module Results Subjects of the module Plans Questions.
Engineering 1040: Mechanisms & Electric Circuits Winter 2015 Interfacing Light-Emitting Diodes (LEDs) & Push Buttons to Microcontrollers.
Digital Electronics Board-of-Education : Input. Board of Education - Input This presentation will explain, both from a hardware and software perspective,
1 ECE 372 – Microcontroller Design Parallel IO Ports - Inputs.
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
12/16/  List the elements of 8255A Programmable Peripheral Interface (PPI)  Explain its various operating modes  Develop a simple program to.
PPI-8255.
July 18, UCSD - R.A. de Callafon Short Intro to Micro Processors and I/O functions of our Kinetic Sculpture Control Box Raymond de Callafon.
EE365 - Microprocessors period 26 10/23/00 D. R. Schertz # Parallel Ports.
ABE425 Engineering Measurement Systems Electronic Parts Dr. Tony E. Grift Dept. of Agricultural & Biological Engineering University of Illinois.
Lecture 4 General-Purpose Input/Output NCHUEE 720A Lab Prof. Jichiang Tsai.
Lab. 1 – GPIO Pin control Using information ENEL353 and ENCM369 text books combined with Blackfin DATA manual.
Chapter 3 Parallel Ports, Power Supply and the Clock Oscillator The aims of this chapter are to introduce: Why we need parallel input/output; How simple.
Submitted by:.  Project overview  Block diagram  Power supply  Microcontroller  MAX232 & DB9 Connector  Relay  Relay driver  Software requirements.
Embedded systems and sensors 1 Part 2 Interaction technology Lennart Herlaar.
Components of a typical full-featured microcontroller.
Simple Water Level Controller Circuit with Microcontroller and Alarm.
ISA CLICK CONTROL #38 – FALL 2014 ERIC BRUNNGRABER DRAKE ISABIRYE.
1. PIC ADC  PIC18F877 has 8 analog input channels i.e. port A pins(RA0 to RA5) and port E pins(RE1 and RE2). These pins are used as Analog input pins.
SENSORS.
ARDUINO BASED UNDERGROUND CABLE FAULT DETECTION
OVER VOLTAGE OR UNDER VOLTAGE
SUBMITTED BY EDGEFX TEAM
AUTO POWER SUPPLY CONTROL FROM 4 DIFFERENT SOURCES: SOLAR, MAINS, GENERATOR & INVERTOR TO ENSURE NO BREAK POWER.
For further information
SUBMITTED BY EDGEFX TEAM
Lecture 6: TI MSP430 IO Interfacing
Programming Boe-Bots (Part 1)
Internet-of-Things (IoT)
CSCI1600: Embedded and Real Time Software
Lab. 1 – GPIO Pin control Using information ENEL353 and ENCM369 text books combined with Blackfin DATA manual.
CSCI1600: Embedded and Real Time Software
The Programmable Peripheral Interface (8255A)
I/O Experiments Assignment 1.
Presentation transcript:

ENGR 355 Take Home Lecture 2

WRITING CODE Introductory Comments /* Disgruntled Avians Lab 6 ENGR355 by Tim Kyle Rev /1/2014 LM-3551 Tilt Sensor attached at SPI port 1. 16x2 LCD parallel interface p5-p12 Reset switch p2 */

WRITING CODE Include, Global Definitions, Interface Assignments and Constants #include “mbed.h” const float pi=3.1415; //constant declaration, does not ever change DigitalOut BlueLED p6; //defines pin 6 as BlueLED int program_cycles=0; //global variable declaration A list of the official libraries can be found at:

WRITING CODE Functions and/or Function Prototypes void porcine_splash() {} //Displays lots of advertisements so my program will make lots of money. void display_lots_of_advertisements{ insert_lots_of_code_here(); collect_the_money_here(); }

WRITING CODE Main function Your code should never end. Often this means it will end with a while(1) or similar unending command. int main() { porcine_splash(); while(1) { display_lots_of_advertisements(); } //if program execution continues down here, uninitialized program memory is executed and BAD things might happen.

GPIO GENERAL PURPOSE INPUT/OUTPUT Pins that can be used as input, output or a combination of both. Most processor pins function as GPIO some have additional functions. On the mbed, the pins capable of GPIO are labelled p5-p30 and p33-p36. An alternative labelling is the processor labelling that includes the port number (ie. P0_8, for Port 0 Pin 8)

GPIO GENERAL PURPOSE INPUT Measures the voltage of a given pin to determine its state. Pin 2.0V is a logic high. DigitalIn enables an automatic pull down resistor Without a pull up or pull down resistor, the logic input can float randomly between states when the switch is open. HIGH IMPEDIENCE LOGIC INPUT ON MICROCONTROLLER 3.3V

GPIO GENERAL PURPOSE INPUT The pull down resistor will pull the logic input low when the switch is open. When the switch is closed the logic input transitions high. HIGH IMPEDIENCE LOGIC INPUT ON MICROCONTROLLER 3.3V

GPIO GENERAL PURPOSE OUTPUT 0 = Logic Low (V OL ≤0.4V)pin will sink current 1 = Logic High (V OH ≥V DD -0.4V) pin will source current The guaranteed minimum source/sink current is 4mA/pin. – This is low compared to other microprocessors. – More typical is 20mA/pin Not all pins are created equally. – P21 is the high current output pin and is guaranteed to drive at least 20mA – P27 and P28 are the open drain pins and are guaranteed to sink at least 20mA – It is safe to source or sink more current (20mA/pin) in the prototype phase.

GPIO GENERAL PURPOSE INPUT & OUTPUT A pin or group of pins, called a bus, can switch roles between inputs and outputs. – This is useful when the pins are driving a bidirectional bus. – In the diagram below, data flows back and forth between the LCD and the Microprocessor on this 4 bit parallel data bus. mbed d1 d2d3d4 d5d6d7d8 p1 p2 p3 p4 p5 p6 p7 p8 LCD

GPIO mbed d1 d2d3d4 d5d6d7d8 p1 p2 p3p4 p5p6p7p8 LCD GENERAL PURPOSE INPUT & OUTPUT When the mbed is sending commands to the LCD the mbed bus on p1-p8 they are acting as outputs.

GPIO mbed d1 d2d3d4 d5d6d7d8 p1 p2 p3 p4 p5 p6 p7 p8 LCD GENERAL PURPOSE INPUT & OUTPUT When the LCD is sending a response the mbed bus must act as inputs to receive the reply.

GPIO Switches A common device connected to a GPIO input is a switch. Switches come in various styles with various features. Tactile Switch Knife Switch Missile Switch Light Switch Easy Button

GPIO Switches Bounce When a switch is moved from one state to another, after the contacts smash together or apart, they bounce before making a solid logic level.

GPIO Debouncing Switch Methods Off-Processor Methods – RC Filter – Flip Flops – Dedicated IC Software Methods – State Machine – Software Low Pass Filter – Edge detect followed by a time delay – DebounceIn interface (mbed specific)

GPIO LEDs driven by a GPIO output. LEDs are handy but without proper current limiting, they can runaway and over heat. Runaway – Forward voltage decreases with an increase in temperature, increasing the drive current, increasing the temperature until they overheat and fail. – Prevent Runaway with a current limiting resistor.

GPIO Indication LED Specifications Significant Specifications for Indication Grade LEDs – Forward Voltage (between 1V and 5V) Generally varies by color – Forward Current (between 1mA and 20mA) – They are related and typically shown as a graph on the datasheet.

LED Resistor Sizing

LED Resistor Sizing

LED Resistor Sizing

LED Resistor Sizing 3.3V GPIO OUTPUT R Current Source GPIO OUTPUT ALMOST 0V R Current Sink 3.3V Inverted Logic

LED Resistor Sizing 3.3V GPIO OUTPUT R Current Source i=10mA

LED Resistor Sizing R Current Source i=10mA V 1.8V V 3.3V + + _ _

LED Resistor Sizing R Current Source i=10mA V 1.8V V 3.3V + + _ _

LED Resistor Sizing R Current Source i=10mA V 1.8V V 3.3V + + _ _ 3.3V - 1.8V - (0.010A*R)=0 1.5V/0.010A = R R=150Ω

LED An LED only works in one direction. Current normally flows from the longer leg (anode) to the shorter leg (cathode). Cathode is usually marked by a flat spot on the plastic housing.

The End