Embedded Programming B. Furman 09MAY2011. Learning Objectives Distinguish between procedural programming and embedded programming Explain the Events and.

Slides:



Advertisements
Similar presentations
Basic Electronics Review B. Furman 27JAN2015. Lecture Flow Today Items to focus on this week  Lab 1  PortMaster build  HW 1 and Questionnaire due Thursday.
Advertisements

In this presentation you will:
1/1/ / faculty of Electrical Engineering eindhoven university of technology Introduction Part 3: Input/output and co-processors dr.ir. A.C. Verschueren.
 Control structures  Algorithm & flowchart  If statements  While statements.
Programming Microcontrollers B. Furman 19MAR2011.
Embedded Computer ( Sisteme incorporate ) MPU vs. CPU / Alternative Texas Instrument, Freescale, ARM RISC and CISC approaches Single Chip Design System.
Debouncing Switches Mechanical switches are one of the most common interfaces to a uC. Switch inputs are asynchronous to the uC and are not electrically.
Programming the ATmega16
CMPE 118 MECHATRONICS Event-Driven Programming and State Machines.
Digital Circuit Why Digital Circuit? – Digital signals ( 0 and 1) are very easy to handle with electronic circuits only 2 states needed: Switch ON or OFF,
November 18, 2004 Embedded System Design Flow Arkadeb Ghosal Alessandro Pinto Daniele Gasperini Alberto Sangiovanni-Vincentelli
Fundamentals of Digital Logic B. Furman 25NOV2014.
DIGITAL DESIGN WITH VHDL Exercise 1 1Muhammad Amir Yousaf.
Department of Computer Science 1 CSS 496 Business Process Re-engineering for BS(CS)
Embedded Software Design Peter R. Wihl (former Guest Lecturer)
Introducing Java.
Advanced Embedded Systems Design Pre-emptive scheduler BAE 5030 Fall 2004 Roshani Jayasekara Biosystems and Agricultural Engineering Oklahoma State University.
RC Filters B. Furman 02SEP2014. Mechatronics Concept Map System to Control Sensor Signal Conditioning Controller (Hardware & Software) Power Interface.
CS 0004 –Lecture 1 Wednesday, Jan 5 th, 2011 Roxana Gheorghiu.
1 Essential Question: Explain the goal of checking “Productivity;” define input and output; list and describe fixed costs, variable costs, and marginal.
Introduction to Graphical User Interfaces. Objectives * Students should understand what a procedural program is. * Students should understand what an.
Programming Concepts Part B Ping Hsu. Functions A function is a way to organize the program so that: – frequently used sets of instructions or – a set.
Event Driven Programming
Revised: Aug 1, ECE 263 Embedded System Design Lessons 23, 24 - Exceptions - Resets and Interrupts.
Operating system Structure and Operation by Dr. Amin Danial Asham.
Invitation to Computer Science, Java Version, Second Edition.
Programing Concept Ken Youssefi/Ping HsuIntroduction to Engineering – E10 1 ENGR 10 Introduction to Engineering (Part A)
HOMEWORK REVIEW This is an if else statement layout if (condition) { code to be executed if condition is true; } else { code to be executed if condition.
Chapter 8 Problems Prof. Sin-Min Lee Department of Mathematics and Computer Science.
Signal Sources B. Furman 31JAN2013. Mechatronics Concept Map System to Control Sensor Signal Conditioning Controller (Hardware & Software) Power Interface.
Microprocessors 1 MCS-51 Interrupts.
ECS642U Embedded Systems Cyclic Execution and Polling William Marsh.
Representing Numerical Data Analog Any signal that varies continuously over time Mechanical Pneumatic Hydraulic Electrical Digital Quantities are represented.
MIT App Inventor Lesson 4 – Decision Making. Agenda Comparisons ◦ Relational Operators Conditions (state checking) ◦ Boolean Operators.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
Visual Basic for Application - Microsoft Access 2003 Programming applications using Objects.
CE Operating Systems Lecture 2 Low level hardware support for operating systems.
How Are Computers Programmed? CPS120: Introduction to Computer Science Lecture 5.
CSCI1600: Embedded and Real Time Software Lecture 16: Advanced Programming with I/O Steven Reiss, Fall 2015.
Embedded Systems Design 1 Lecture Set 8 MCS-51 Interrupts.
Chapter 2 Process Management. 2 Objectives After finish this chapter, you will understand: the concept of a process. the process life cycle. process states.
Lecture 15: Course Review BJ Furman ME 30 16MAY2011.
Embedded Control Systems Dr. Bonnie Heck School of ECE Georgia Tech.
Slides created by: Professor Ian G. Harris Operating Systems  Allow the processor to perform several tasks at virtually the same time Ex. Web Controlled.
CSCI1600: Embedded and Real Time Software Lecture 15: Advanced Programming Concepts Steven Reiss, Fall 2015.
Hardware Description Languages ECE 3450 M. A. Jupina, VU, 2014.
Interrupts and Exception Handling. Execution We are quite aware of the Fetch, Execute process of the control unit of the CPU –Fetch and instruction as.
© Janice Regan, CMPT 300, May CMPT 300 Introduction to Operating Systems Operating Systems Overview: Using Hardware.
Lecture Notes / PPT UNIT III
Digital Control CSE 421.
Architectures of Digital Information Systems Part 1: Interrupts and DMA dr.ir. A.C. Verschueren Eindhoven University of Technology Section of Digital.
Lesson Objectives Aims Key Words Interrupt, Buffer, Priority, Stack
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
Event Driven Programming
ME 190 Mechatronic Systems Design
CSCI1600: Embedded and Real Time Software
Interrupts, Tasks and Timers
Lesson 1: Overview of Sequential Control and Data Acquisition
RC Filters B. Furman 09FEB2016.
Notes on Lab 1 – Intro to the Mechatronics Lab
Event Driven Programming
CSCI1600: Embedded and Real Time Software
Chapter 8 I/O.
Chapter 3: Selection Structures: Making Decisions
Programming Concepts and Database
ENGR 1 Presentation Thomas Matthews.
CSCI1600: Embedded and Real Time Software
CSCI1600: Embedded and Real Time Software
Programming Concepts (Part B) ENGR 10 Introduction to Engineering
CSCI1600: Embedded and Real Time Software
Presentation transcript:

Embedded Programming B. Furman 09MAY2011

Learning Objectives Distinguish between procedural programming and embedded programming Explain the Events and Services embedded programming framework  Explain what an Event is  Explain what a Service is Explain the key rule and its two corollaries Describe how an event checking routine works for  Discrete quantities  Analog quantities Develop code for:  an event checking routine  a service  an event driven system

Mechatronics Concept Map Controller (Hardware & Software) System to Control Sensor Signal Conditioning Power Interface Actuator User Interface Power Source BJ Furman 22JAN11 ME 106 ME 154 ME 157 ME 195 ME 120 ME 297A ME 106 ME 120 ME 106 ME 190 ME 187 ME 110 ME 136 ME 154 ME 157 ME 182 ME 189 ME 195 ME 106 ME 120 ME 106 INTEGRATION

Procedural vs. Embedded Programming Procedural  ME 30/CmpE 46  Computation and analysis programs  Mostly sequential Start  …  End  Known inputs and outputs Program is in control  Predictable operation and timing Embedded  ME 106  Inputs and outputs can occur at any time, in any order and are not predictable  Inputs can come from multiple sources Sensors, user inputs, or internal (timer, ADC, etc.)  May handle simultaneous inputs and outputs  Program never ends

Event Driven Program Structure Programming task divides into:  Checking for events  Servicing events when they occur Event  A detectable change or transition in something of interest Button press (before: not pressed, after: pressed) ADC complete flag bit set Service  An action taken in response to an event

Requirements for Events and Services The occurrence of events must be checked for continuously and often Services must execute quickly and must be non-blocking  Ex. Determine if a switch has closed Blocking code:  while(digitalRead(pin) == HIGH);

Event Checkers for Discrete Events Ex. Check that a switch has closed  Pseudocode IF switch is closed AND switch was open last time, THEN  SwitchClosed event has occurred ELSE  SwitchClosed event has not occurred  Need to keep track of the state of the switch (i.e., maintain its history) Use a state variable Will need to be declared as a static local variable in the function that checks for the event  Need to retain the value between successive calls to the event checking function

Code to Check for Discrete Events

Events involving an analog quantity A single-valued threshold will likely result in “chatter” when the quantify of interest is near the threshold

Event Checkers for Events Involving Analog Quantities Filtering the signal may help Add hysteresis in the event checker  Make the criteria for when the event occurs a variable instead of a fixed value Initially threshold is set to an upper value As soon as the signal crosses the threshold, the threshold is dropped to a lower value  Pseudocode: Set threshold to high value IF var is greater than or equal to the threshold, THEN  Event has happened  Set threshold to lower value ELSE  Event has not happened

Event Detection with Hysteresis

Code to Check for Events With Analog Quantities

Main body of Events & Services Code