EE 319K Introduction to Microcontrollers

Slides:



Advertisements
Similar presentations
Chapter 5 Tutorial 5a. Editing and Assembling From Valvano.
Advertisements

Lecture 15 Finite State Machine Implementation
TOPIC : Finite State Machine(FSM) and Flow Tables UNIT 1 : Modeling Module 1.4 : Modeling Sequential circuits.
10-1 EE 319K Introduction to Microcontrollers Lecture 10: Interrupts, Output Compare Periodic Interrupts Read Book Sections 9.1, 9.2, 9.4, 9.6.1, 9.6.2,
ELEC 330 Digital Systems Engineering Dr. Ron Hayne
1 Lecture 23 More Sequential Circuits Analysis. 2 Analysis of Combinational Vs. Sequential Circuits °Combinational : Boolean Equations Truth Table Output.
68HC11 Polling and Interrupts
Computer ArchitectureFall 2007 © October 1st, 2007 Majd F. Sakr CS-447– Computer Architecture.
DISCUSSION CSE 140L 3 rd November 2010 Vikram Murali.
ECE 331 – Digital System Design Introduction to and Analysis of Sequential Logic Circuits (Lecture #20) The slides included herein were taken from the.
ECE 331 – Digital System Design
ENGIN112 L31: Read Only Memory November 17, 2003 ENGIN 112 Intro to Electrical and Computer Engineering Lecture 31 Read Only Memory (ROM)
Basic Register A register is a sequential component that can store multiple bits.
11-1 Bard, Tiwari, Telang, Janapa Reddi, Gerstlauer, Valvano, Yerraballi EE 319K Introduction to Embedded Systems Lecture 11: Data Acquisition, Numerical.
7-1 EE 319K Introduction to Embedded Systems Lecture 7: Phase-locked-loop, Data structures, Finite state machines, Interrupts Bard, Gerstlauer, Valvano,
1-1 Ramesh Yerraballi EE 319K Introduction to Microcontrollers Lecture 1: Introduction, Embedded Sys, Product Life- Cycle, 9S12 Programming.
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)
CS 151 Digital Systems Design Lecture 31 Read Only Memory (ROM)
ECE 265 – LECTURE 9 PROGRAM DESIGN 8/12/ ECE265.
Lecture 10 Topics: Sequential circuits Basic concepts Clocks
Lab 1 – Assembly Language and Interfacing Start date: Week 3 Due date: Week 4 1.
EE 319K Introduction to Microcontrollers
EE434 ASIC & Digital Systems
Objectives Implement pointers using indexed addressing modes Use pointers to access arrays, strings, structures, tables, and matrices Present finite-state.
Advanced Digital Circuits ECET 146 Week 5 Professor Iskandar Hack ET 221G, Me as I typed this slides.
Lecture 18 More Moore/Mealy machines.
9-1 EE 319K Introduction to Microcontrollers Lecture 9:I/O Synchronization; LCD Interfacing; Implementing Local Variables using a Stack Frame; Parameter.
Module : FSM Topic : types of FSM. Two types of FSM The instant of transition from the present to the next can be completely controlled by a clock; additionally,
Computer Organization & Programming Chapter 5 Synchronous Components.
6-1 EE 319K Introduction to Microcontrollers Lecture 6: Indexed Addressing Mode and Variants, Functional Debugging, Arrays, Strings.
Ch. 6 Pointers and Data Structures From the text by Valvano: Introduction to Embedded Systems: Interfacing to the Freescale 9S12.
DLD Lecture 26 Finite State Machine Design Procedure.
3-1 EE 319K Introduction to Microcontrollers Lecture 3: Addressing modes, Memory Operations, Subroutines, I/O, Logical/Shift Operations.
1 Segments and Pseudo Operations Program Development.
ANALYSIS OF SEQUENTIAL CIRCUITS by Dr. Amin Danial Asham.
George W. Woodruff School of Mechanical Engineering, Georgia Tech ME4447/6405 ME 4447/6405 Microprocessor Control of Manufacturing Systems and Introduction.
8-1 EE 319K Introduction to Microcontrollers Lecture 8:Fixed Point Numbers, Local Variables, Binding, Allocation, Access, Deallocation.
ECE Lecture 21 Typical Assembly Language Program Bugs.
Ch.2 Intro. To Assembly Language Programming From Introduction to Embedded Systems: Interfacing to the Freescale 9s12 by Valvano, published by CENGAGE.
ECE 447: Lecture 16 Common Errors & Good Programming Style.
Digital System Design using VHDL
Sichuan University Software College
High Performance Embedded Computing © 2007 Elsevier Lecture 4: Models of Computation Embedded Computing Systems Mikko Lipasti, adapted from M. Schulte.
Embedded Systems Lecture 5 January 25 th, 2016.
Lecture 22: Finite State Machines with Output. Moore Machine - A Moore machine is a 6-tuple (Q, , , , q 0,  ) where, (1) Q is a finite set of states.
Finite State Machine. Clock Clock cycle Sequential circuit Digital logic systems can be classified as combinational or sequential. – Combinational circuits.
ECE 447: Lecture 13 Assembler Directives. ECE 447: Defining a Constant #define PORTB 0x1004PORTB EQU $1004 #define DELAY 100 ………. #undef DELAY #define.
5-1 EE 319K Introduction to Microcontrollers Lecture 5: Conditionals, Loops, Modular Programming, Sub- routines, Parameter passing.
George Mason University Finite State Machines Refresher ECE 545 Lecture 11.
Controller Implementation
ECE 3430 – Intro to Microcomputer Systems
Introduction to Sequential Logic Design
Control Structure Applications
IAY 0600 Digital Systems Design
Additive and Multiplicative Relationships
ME 4447/6405 Microprocessor Control of Manufacturing Systems and
CSE 140L Discussion Finite State Machines.
CSE322 Mealy and Moore Machine
Relations vs. Functions Function Notation, & Evaluation
EE 319K Introduction to Embedded Systems
Advanced FPGA Based System Design
Dynamic Modeling Lecture # 37.
IAS 0600 Digital Systems Design
CSE 370 – Winter Sequential Logic-2 - 1
Lecture 20 Logistics Last lecture Today HW6 due Wednesday
Objective- To use an equation to graph the
Objective- To graph a relationship in a table.
Accum A: Index X: CCR Bit Z: $0100 $0101 $0102 $0103 $0104 $0105
Presentation transcript:

EE 319K Introduction to Microcontrollers Lecture 7: Finite State Machines

Finite State Machines - FSM Software abstraction define a problem with a set of basic abstract principles separate policies mechanisms Finite State Machine (FSM.) inputs, outputs, states, and state transitions state graph defines relationships of inputs and outputs The three advantages of this abstraction are it can be faster to develop it is easier to debug (prove correct) and it is easier to change What is a state? Description of current conditions What is a state graph? Graphical interconnection between states What is a controller? Software that inputs, outputs, changes state Accesses the state graph Ramesh Yerraballi

Moore FSM Output value depends only on the current state, and Inputs affect the state transitions Significance is being in a state Input: when to change state Output: how to be in that state Ramesh Yerraballi

Mealy FSM Output value depends on input(s) and current state Inputs affect the state transitions Significance is the state transition Input: when to change state Output: how to change state Ramesh Yerraballi

Implementation of FSM data structure embodies the FSM multiple identically-structured nodes statically-allocated fixed-size linked structures one-to-one mapping FSM state graph and linked structure one structure for each state linked structure pointer (or link) to other nodes (define next states) table structure indices to other nodes (define next states) Ramesh Yerraballi

Stepper Motor Controller * RAM variables org $0800 Pt rmb 2 ;pointer to current state * ROM constants org $4000 out equ 0 ;8-bit output wait equ 1 ;time to wait next equ 3 ;4 pointers to next state S5 fcb $05 ;4-bit output fdb 4000 fdb S5,S9,S6,S5 ;next for each in S6 fcb $06 fdb S6,S5,S10,S6 S10 fcb $0A fdb S10,S6,S9,S10 S9 fcb $09 fdb S9,S10,S5,S9 * ROM program Main lds #$4000 bsr Timer_Init ; activate TCNT bclr DDRH,#$C0 ;PH6,7 input bset DDRP,#$0F ;PP3-0 output movb #$05,PTP ; initial output movw #S5,Pt ; initial state loop ldx Pt movb out,X,PTP ; step motor ldd wait,X bsr Timer_Wait ; wait specified time ldaa PTH ; read inputs anda #$C0 ; just CCW,CW ; 0,40,80,C0 lsra ; 0,20,40,60 lsra ; 0,10,20,30 lsra ; 0,08,10,18 lsra ; 0,04,08,0C lsra ; 0,02,04,06 leax next,X ; list of pointers ldx A,X ; next depends on in stx Pt bra loop Ramesh Yerraballi

Stepper Motor FSM CCW: PH6=1 & PH7=0 CW: PH6=0 & PH7=1 Outputs connected to PP3,PP2,PP1,PP0 Control Stepper Motor For example, when in state S9 the output is 1001 which is written to the pins PP3(1), PP2(0), PP1(0) and PP0(1) Ramesh Yerraballi