State Diagrams and enums ECE152. Overview What is a state diagram and where are they used? – Digital Logic – Coding Why use a states? How are states done.

Slides:



Advertisements
Similar presentations
Introduction to Programming
Advertisements

Summer Computing Workshop. Introduction to Variables Variables are used in every aspect of programming. They are used to store data the programmer needs.
The Logic of Quantified Statements
Spring 2009W. Rhett DavisNC State UniversityECE 406Slide 1 ECE 406 – Design of Complex Digital Systems Lecture 8: Sequential Design Spring 2009 W. Rhett.
Programming Tools for Solution Development Module 3 Lesson 2 Assignment: Notes.
Lesson 5 - Decision Structure By: Dan Lunney
Timers in Hardware ECE152. Overview Why are timers important – Watchdog – Task switching – Accurate time of day Can use polling or interrupts.
MATLAB Loops and Branching.
ECE 331 – Digital System Design Basic Logic Functions, Truth Tables, and Standard Logic Gates.
Problem Solving Chapter 2. What is an algorithm? n A solution to a problem that is: –Precise –Effective –Terminating.
Rounding Decimals.
Chapter 3: Set Theory and Logic
Graphical Tree-Based Scientific Calculator: CalcuWiz Will Ryan Christian Braunlich.
CS1101: Programming Methodology Aaron Tan.
Practice Problems to become familiar with circuits and circuit diagrams.
Drawing and the Brain “In order to draw, we must learn how to see.”
Fundamental Digital Electronics (Spring 2014) Martino Poggio.
1/8/ L20 Project Step 8 - Data Path Copyright Joanne DeGroat, ECE, OSU1 State Machine Design with an HDL A methodology that works for documenting.
Designing classes How to write classes in a way that they are easily understandable, maintainable and reusable 5.0.
Scientific Method. Where did we leave off?  What makes science “science”  All fields of science use it  Sometimes called Scientific Inquiry  Logical.
PROGRAM DEVELOPMENT CYCLE. Problem Statement: Problem Statement help diagnose the situation so that your focus is on the problem, helpful tools at this.
SIMULINK-Tutorial 1 Class ECES-304 Presented by : Shubham Bhat.
Let’s learn about it. 10.
1 Chapter 3: Loops and Logic. 2 Control Statements If statement Example NumberCheck.java Relational operators (, >=, ==, !=) Using code blocks with If.
QUALITY MANAGEMENT PRINCIPLES. Objectives 4 Understand usefulness of CASE tools 4 Types of CASE tools 4 Data flow diagrams (DFD)
Arithmetic Logic Units
3:00. 2:59 2:58 2:57 2:56 2:55 2:54 2:53 2:52.
IP Circuit diagrams © Oxford University Press 2011 Circuit diagrams.
Chapter - State Based Design Systems have modes of operation. The controller should move sequentially between these states.
Software Engineering: Models David Millard
 Problem Analysis  Coding  Debugging  Testing.
Learning and remembering.
Debuggers. Errors in Computer Code Errors in computer programs are commonly known as bugs. Three types of errors in computer programs –Syntax errors –Runtime.
Trace Tables In today’s lesson we will look at:
Q1: Draw a simple flowchart to show a decision.
Program design Program Design Process has 2 phases:
Basic Introduction to C#
© 2016, Mike Murach & Associates, Inc.
Equations – Solving for Y
C-Language Lecture By B.S.S.Tejesh, S.Neeraja
Chapter 2.3 Binary Logic.
Fractions on a Number Line
Remember how we can use partitioning to help us to subtract?
Top Fire Protection Services Ottawa available on Dubinskyconstruction
For -G7 programing language Teacher / Shamsa Hassan Alhassouni.
Problem Solving Techniques
Complimentary & Supplementary Angles
Elec 2607 Digital Switching Circuits
Variables in C Topics Naming Variables Declaring Variables
Documentation for Developers
10:00.
Week 1 Focus/Farm Animals
Visual Basic – Decision Statements
Let’s think about how to find the volume of a shape like
C.2.10 Sample Questions.
C.2.8 Sample Questions.
C.2.8 Sample Questions.
C Language B. DHIVYA 17PCA140 II MCA.
Variables in C Topics Naming Variables Declaring Variables
Missing digits game.
LANGUAGE EDUCATION.
Variables in C Topics Naming Variables Declaring Variables
Redundant code repositories
WRITING AN ALGORITHM, PSEUDOCODE, AND FLOWCHART LESSON 2.

Programming in C# CHAPTER - 9
Lesson 3. Controlling program flow. Loops. Methods. Arrays.
CSCI 3328 Object Oriented Programming in C# Review: Exam I
Variables in C Topics Naming Variables Declaring Variables
Presentation transcript:

State Diagrams and enums ECE152

Overview What is a state diagram and where are they used? – Digital Logic – Coding Why use a states? How are states done in code?

Why use states? States let your functions ‘be aware’ of what is going on in the program currently They allow for easy partitioning of modes They are easy to understand while leaving out the language

How are states done in code? You need a state variable You could use any data type, but you have to remember what each state means. What if there are 100s of states?

Using enum makes things better No numbers or weird code to remember enum states { state1, state2, state3} state; Look, descriptive names enum states { start, stop, clear} state;

Use a switch statement Switch statements are much ‘cleaner’ than nested if statements

Example Look at this sample program. From what it does, lets draw a state diagram.

Things to Remember States give a framework to write code