Embedded Systems Programming (What they do and when / how to use them)

Slides:



Advertisements
Similar presentations
Week10 Boolean Instructions on the Boolean Instructions  Boolean (or Bit) addressable capability is unique to the 8051  Enables efficient handling.
Advertisements

Introduction to Micro-controllers Anurag Dwivedi.
Unit 7 Parallel Circuits
ELECTRICAL. Circuits Outline Power Hub Microcontroller Sensor Inputs Motor Driver.
Programming the ATmega16
7/10/2007 AIIT Summer Course - D# 1 Wireless Embedded Systems and Networking Lab Day 2: Part 1: Add your own external sensors Lab Assistant: Jaein Jeong.
ECE 265 – LECTURE 13 Interface to switches and LEDs 7/3/ ECE265.
Digital I/O Connecting to the Outside World
EEE305 Microcontroller Systems Lecture 5B: Simple I/O Embedded C using PIC microcontrollers Teaching resources on on
Electric Circuits Electricity for Refrigeration, Heating and Air Conditioning 7th Edition Chapter 3 Electric Circuits.
Ohm’s Law The most important fundamental law in electronics is Ohm’s law, which relates voltage, current, and resistance. Georg Simon Ohm ( ) studied.
Circuits  Electricity flowing through a substance is called an electric current.  A circuit is a path through which electricity flows from a negative.
Network and Systems Laboratory nslab.ee.ntu.edu.tw.
I/O Ports CS-280 Dr. Mark L. Hornick 1. CS-280 Dr. Mark L. Hornick 2 Ports are channels from the CPU to external hardware and software Atmega32 has: 4.
Chapter Twenty: Electric Circuits
Investigation 16B  Key Question: What is the relationship between current and voltage in a circuit? Resistance and Ohm’s Law.
Teachers Name : Suman Sarker Telecommunication Technology Subject Name : Microcontroller & Embedded System Subject Code : 6871 Semester : 7th Department.
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,
Calculating Electricity
Bellringer A standard household outlet has a voltage of what?
1 HVACR216 - Hydronics Basic Circuits and Ohms Law.
ELECTRIC CURRENT 2 Ohm’s law shows the relationship between current, potential, and voltage. We need a few more rules to make predictions about current.
Electrical Resistance Electrical resistance is a measure of how difficult it is for electricity (electrons) to flow through a material. The units of resistance.
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
Automatic accident avoiding system PROJECT MEMBERS MUTHUKUMAR.K (05ME33) SAKTHIDHASAN.S (05ME39) SAKTHIVEL.N (05ME40) VINOTH.S (05ME56) PROJECT GUIDE:
Chapter 8. Ohm’s Law  George Ohm experimented with circuits and came up with a mathematical relationship relating voltage, current and resistance in.
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.
ECE Lecture 1 1 L15 –I/O Part II Department of Electrical and Computer Engineering The Ohio State University ECE 2560.
Presented by Sadhish Prabhu
INTERNET OF EVERYTHING SDU 2016 Week 4. Simple Digital and Analog Inputs  The Arduino’s ability to sense digital and analog inputs allows it to respond.
Voltage Divider Circuits Input transducers Input transducers are devices that convert a change in physical conditions (for example, temperature) into a.
5.2.2 D.C. Circuits Practical circuits Electromotive force and internal resistance Kirchhoff’s laws Series and parallel arrangements Potential divider.
Amperes, Volts and Ohms. We use different units to measure different things: We use different units to measure different things: Time – minutes Time –
SIMPLE CIRCUITS. DC CIRCUITS DC cicuits include a power supply, one or more load devices that convert electrical energy into another type of energy, and.
Jag Mark Name 4 factors that can affect the resistance of a current?
Electricity and its characteristics…  Conventional Flow theory states that flow of electrons is from positive to negative.(Accepted in the transportation.
Sensors and Actuators Simple Sensors Switches and Pots Other Sensors Simple Actuators LEDs and Buzzers DC Motors MAE 156A.
Application Case Study Christmas Lights Controller
Purpose of This Minilab
Seven Segment Displays
Application Case Study Security Camera Controller
Peripherals – Keypad The Keypad provides a simple means of numerical data or control input. The keys can be attributed whatever data or control values.
Ohm’s Law.
Environment Temperature Monitor
AVR ATMEGA 8 MICRO-CONTROLLER
Microcontroller Based Digital Code Lock
What’s Inside the Buffer?
Refer to Chapter 10 in the reference book
Graduation Project-II submitted to:
Pulse Width Modulation (PWM) Motor Feedback - Shaft Encoder
Seven Segment Displays
Seven Segment Displays
Intro to Engineering Electronics
Seven Segment Displays
ARDUINO     What is an Arduino? Features 14 Digital I/O pins 6 Analogue inputs 6 PWM pins USB serial 16MHz Clock speed 32KB Flash memory 2KB SRAM.
Internet-of-Things (IoT)
Chapter 17 Section 2: Current.
Chapter 7 section 2 Electric Current
Review Read the comments I have written in your book.
Seven Segment Displays
Intro to Engineering Electronics
Ohm’s Law The relationship between voltage, current and resistance is known as Ohm’s Law: V = IR Voltage (V) = Current (I) x Resistance (R) Volts.
Basic circuits Electrical circuits Electrical properties Ohm’s law
Decoding and Using a 4x4 Keyboard
CHAPTER HARDWARE CONNECTION.
Chapter Twenty: Electric Circuits
Decoding and Using a 4x4 Keyboard
Example Example 1: An electric lamp is rated 110 W, 200 V. When the lamp is operated at its rated power and voltage, calculate a) the current flowing through.
I/O Experiments Assignment 1.
Presentation transcript:

Embedded Systems Programming (What they do and when / how to use them) Pullup resistors (What they do and when / how to use them) 1

Resistors – How they work A resistor is a device which restricts the flow of electrical current. The amount of current flowing through a particular resistor is a liner function of the voltage across the resistor and the actual amount of resistance the resistor has (e.g. a 100 Ohm resistor restricts current more than a 10 Ohm resistor). The relationship between Voltage (V measured in Volts), Current (I measured in Amps) and Resistance (R measured in Ohms) is given by Ohms law: V = I * R This can be re-arranged: I = V / R Example 5V Voltage difference across the resistor is 5V – 0V = 5V Current = 5Volts / 1000 Ohms = 5 milliAmps 1KΩ resistor Current flow 0V 2 Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Pullup resistors – Why they are needed An input pin with nothing connected to it could read as either a ‘0’ or a ‘1’. Generally when an input pin is not used in the design, you will not read it in the software, so this is not a problem. However, some types of input device only pull the input pin in one direction; consider a simple switch: Two switches both closed = short ! both open = ? Single throw switch closed = 0, open = ? Double throw switch position1 = 0, position2 = 1 Vcc (5V) Vcc (5V) Vcc (5V) Microcontroller Microcontroller Microcontroller Input pin Input pin Input pin Limited applicability Bad Bad Gnd (0V) Gnd (0V) Gnd (0V) 3 Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Pullup resistors – The concept A microcontroller needs only a very small current flow on an input pin to signal a logic level. If a resistor (up to about 10KΩ) is used to connect, the port pin will register the value in the same way as if a direct connection to +Vcc or Gnd was made. The use of a resistor enables a predictable port bit reading even if only a simple switch or input device that only pulls the pin in one direction, is used. Vcc (5V) 1KΩ resistor Single throw switch with pullup resistor closed = 0 (relatively large current flows through switch, overpowers resistor current) open = 1 (small current flows through resistor) Microcontroller Input pin Good Gnd (0V) Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Pullup resistors – Internal, programmable pullup resistors Gnd (0V) Vcc (5V) Input pin Microcontroller pullup resistor S/w controlled switch – allows setting the pullup resistors on/off from within a program To minimise the number of external components needed, and to maximise flexibility, the ATMEL microcontrollers have internal pullup resistors which can be connected / disconnected programmatically (i.e. from within a program). Single throw switch with internal pullup resistor selected on closed = 0 (relatively large current flows through switch, overpowers resistor current) open = 1 (small current flows through resistor) This configuration requires less external components (cheaper, smaller system size, quicker to build) Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich

Pullup resistors – Programming the internal pullup resistors Programming the pullups requires an extra step when setting up the ports. A ‘1’ is set in the PORTn register to set the pullup resistor for each bit. This must be done after the port bit has been set for input direction, otherwise you are just setting the output bit value! Example: set the pullup resistors on for port B bit 3 and all bits of port C ldi TEMP, 0b00000000 out DDRB, TEMP // set all bits of port B for input ldi TEMP, 0b00001000 out PORTB, TEMP // set the pullup resistor for bit 3 of port B out DDRC, TEMP // set all bits of port C for input ldi TEMP, 0b11111111 out PORTC, TEMP // set all pullup resistors on for port C Note that using the pullup resistors makes sense only when the port pin is used as a digital input. Do not use when the pin is used as an output, or when analogue inputs are used. Embedded Systems Programming II Richard Anthony, Computer Science, The University of Greenwich