State Machines An approach to assembler coding. Intro State Machines are an integral part of software programming. State machines make code more efficient,

Slides:



Advertisements
Similar presentations
More on Psuedo-Code Sangeetha Parthasarathy 1/23/01.
Advertisements

ENGG1100 Introduction to Engineering Design Omni-wheel Car Additional Documentation.
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
Give qualifications of instructors: DAP
CHAPTER 1 SOFTWARE DEVELOPMENT. 2 Goals of software development Aspects of software quality Development life cycle models Basic concepts of algorithm.
1 Software Design Introduction  The chapter will address the following questions:  How do you factor a program into manageable program modules that can.
Course contents 1.Labview basics – virtual instruments, data flow, palettes 2.Structures – for, while, case,... – editing techniques 3.Controls&Indicators.
An Object-Oriented Approach to Programming Logic and Design
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Case Tools Trisha Cummings. Our Definition of CASE  CASE is the use of computer-based support in the software development process.  A CASE tool is a.
What is Software Design?  Introduction  Software design consists of two components, modular design and packaging.  Modular design is the decomposition.
Copyright Irwin/McGraw-Hill Software Design Prepared by Kevin C. Dittman for Systems Analysis & Design Methods 4ed by J. L. Whitten & L. D. Bentley.
Copyright © 2009 Pearson Education, Inc. Publishing as Prentice Hall Essentials of Systems Analysis and Design Fourth Edition Joseph S. Valacich Joey F.
Well-behaved objects Debugging. 2 Objects First with Java - A Practical Introduction using BlueJ, © David J. Barnes, Michael Kölling Prevention vs Detection.
Department of Electrical and Computer Engineering Texas A&M University College Station, TX Abstract 4-Level Elevator Controller Lessons Learned.
4/10/20081 Lab 9 RT methodology introduction Register operations Data Path Control Path ASM Example TA: Jorge Crichigno.
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 1 Introduction to Object-Oriented Programming and Software Development.
Chapter 1 Principles of Programming and Software Engineering.
Visual Basic Introduction IDS 306 from Shelly, Cashman & Repede Microsoft Visual Basic 5: Complete Concepts and Techniques.
Applied Software Project Management Andrew Stellman & Jennifer Greene Applied Software Project Management Applied Software.
ECE 301 – Digital Electronics Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #17)
ECE 331 – Digital Systems Design Introduction to Sequential Logic Circuits (aka. Finite State Machines) and FSM Analysis (Lecture #19)
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Copyright 2006 Prentice-Hall, Inc. Essentials of Systems Analysis and Design Third Edition Joseph S. Valacich Joey F. George Jeffrey A. Hoffer Chapter.
SDLC. Information Systems Development Terms SDLC - the development method used by most organizations today for large, complex systems Systems Analysts.
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
The Project AH Computing. Functional Requirements  What the product must do!  Examples attractive welcome screen all options available as clickable.
Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall 1.1.
1 © Unitec New Zealand Embedded Hardware ETEC 6416 Date: - 10 Aug,2011.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
Introduction to High-Level Language Programming
Managing Software Quality
A Simple Tour of the MSP430. Light LEDs in C LEDs can be connected in two standard ways. Active high circuit, the LED illuminates if the pin is driven.
Coupling and Cohesion Pfleeger, S., Software Engineering Theory and Practice. Prentice Hall, 2001.
Ulster.ac.uk Embedded Systems Designing the high level structure of your embedded system Ian McCrum School of Engineering.
1 The Software Development Process  Systems analysis  Systems design  Implementation  Testing  Documentation  Evaluation  Maintenance.
Chapter 1 Introduction to Structured Design. Introduction  System  A combination of people, equipment, and procedures that work together to perform.
Software Development Cycle What is Software? Instructions (computer programs) that when executed provide desired function and performance Data structures.
Software Development. Software Developers Refresher A person or organization that designs software and writes the programs. Software development is the.
Implementing software in IEC Languages in IEC IEC uses the following languages Instruction List – Assembly level programming using.
© 2006 ITT Educational Services Inc. SE350 System Analysis for Software Engineers: Unit 10 Slide 1 Chapter 13 Finalizing Design Specifications.
Programming and Languages
Slide 1 Project 1 Task 2 T&N3311 PJ1 Information & Communications Technology HD in Telecommunications and Networking Task 2 Briefing The Design of a Computer.
The Software Development Process
1-1 Software Development Objectives: Discuss the goals of software development Identify various aspects of software quality Examine two development life.
July 7, 2003 Slide 1 of 6 Automation, Robotics and Mechatronics Lab, SUNY at Buffalo Introduction To Programming Chetan Jadhav Talib Bhabharawala Seung-Kook.
© 2006 Pearson Addison-Wesley. All rights reserved2-1 Chapter 2 Principles of Programming & Software Engineering.
Finite State Machine (FSM) Nattha Jindapetch December 2008.
© 2006 Pearson Addison-Wesley. All rights reserved 2-1 Chapter 2 Principles of Programming & Software Engineering.
Software Engineering and Object-Oriented Design Topics: Solutions Modules Key Programming Issues Development Methods Object-Oriented Principles.
PROGRAMMABLE LOGIC CONTROLLER (PLC) AND AUTOMATION
Objects First With Java A Practical Introduction Using BlueJ Well-behaved objects 2.1.
CS 351/ IT 351 Modeling and Simulation Technologies Review ( ) Dr. Jim Holten.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Unit – I Presentation. Unit – 1 (Introduction to Software Project management) Definition:-  Software project management is the art and science of planning.
Click the pictures to advance to next slide Use the left arrow to go back.
Traditionally ladder logic programs have been written by thinking about the process and then beginning to write the program. This always leads to programs.
ALGORITHMS AND FLOWCHARTS. Why Algorithm is needed? 2 Computer Program ? Set of instructions to perform some specific task Is Program itself a Software.
CSCI 161 Lecture 3 Martin van Bommel. Operating System Program that acts as interface to other software and the underlying hardware Operating System Utilities.
BYU CS/ECEn 124Lab 2 - FSM Lab1 Lab 2 – Finite State Machine Using the Digital State Machine Simulator, create five different machine configuration files.
SOFTWARE TESTING LECTURE 9. OBSERVATIONS ABOUT TESTING “ Testing is the process of executing a program with the intention of finding errors. ” – Myers.
Coupling and Cohesion Schach, S, R. Object-Oriented and Classical Software Engineering. McGraw-Hill, 2002.
Protocol Architectures. Simple Protocol Architecture Not an actual architecture, but a model for how they work Similar to “pseudocode,” used for teaching.
Integrating Algorithms and Coding into the Mathematics Classroom
Information Systems Development
Animation and Simulation Plus Interaction
System Design.
TRANSLATORS AND IDEs Key Revision Points.
Unit# 9: Computer Program Development
COS 260 DAY 16 Tony Gauvin.
Presentation transcript:

State Machines An approach to assembler coding

Intro State Machines are an integral part of software programming. State machines make code more efficient, easier to debug and help organize the program flow. State machines are not limited to just firmware, they can be used to streamline any system. We will look at their use in assembler.

What is a FSM A Finite State Machine (FSM) is based on the idea of there being finite number of states for a given system. For instance, when an application turns an LED on and off, two states exist; one state is when the LED is on and the other is when it is off. The example will turn on eight LEDs sequentially. Only one LED is on at a time, therefore eight states exist. Each state consists of one LED being turned on while all the rest are off.

State variable State machines require a State Variable (SV). The SV is essentially a pointer that keeps track of the state that the microcontroller is in, and directs the program flow to the corresponding software module. The SV can be modified in the software modules (or states) themselves or by an outside function. The example firmware uses an outside function which detects a button press to advance through the states.

State machine state variable next state logic inputs from environment outputs to the environment Next state

Benefits The first advantage is using state machines inherently promotes good design techniques. When beginning to implement an application, think about what states are necessary to make the application work. List all the pieces, or states, of an application and then explore how they tie to one another. This will help prevent developing bugs in the code. This line of thinking also leads to the development of a very useful engineering tool – the flow chart. The following slide covers state machine development in greater detail.

Return to sender State machine programs have one characteristic that cause them to be very beneficial. They always return to one spot (or jump station) in the code at which the program flow is channeled, by the state variable, to the corresponding software module. This characteristic makes calling repetitive tasks on a regular basis quite simple. Clearing the watchdog timer, checking for I/O button presses or communicating with a host that requires periodic communication are examples of repetitive tasks.

Better than loops The alternative to using state machines is to use looping code. In order for looping code to handle repetitive tasks, the functions that handle these tasks must be distributed throughout the code in each of the loops. This is not only highly inefficient but also confusing to understand. The next slide shows a block diagram of what the example code would look like if a state machine where not used.