ECE Experiment #4 Seven Segment Display Interfacing and Timing

Similar documents
ECE Experiment #6 Kitchen Timer

EE1000 Project 4 Digital Volt Meter

ECE COMBINATIONAL BUILDING BLOCKS - INVEST 13 DECODERS AND ENCODERS

Seven-Segment Display Driver

1 Introduction to Modulo 7 Arithmetic

CS September 2018

Present state Next state Q + M N

Module graph.py. 1 Introduction. 2 Graph basics. 3 Module graph.py. 3.1 Objects. CS 231 Naomi Nishimura

, each of which is a tree, and whose roots r 1. , respectively, are children of r. Data Structures & File Management

Outline. 1 Introduction. 2 Min-Cost Spanning Trees. 4 Example

(2) If we multiplied a row of B by λ, then the value is also multiplied by λ(here lambda could be 0). namely

Cycles and Simple Cycles. Paths and Simple Paths. Trees. Problem: There is No Completely Standard Terminology!

Designing A Concrete Arch Bridge

Physics 3150, Laboratory 9 Clocked Digital Logic and D/A Conversion

CSE 373: More on graphs; DFS and BFS. Michael Lee Wednesday, Feb 14, 2018

Outline. Computer Science 331. Computation of Min-Cost Spanning Trees. Costs of Spanning Trees in Weighted Graphs

QUESTIONS BEGIN HERE!

Tangram Fractions Overview: Students will analyze standard and nonstandard

Why the Junction Tree Algorithm? The Junction Tree Algorithm. Clique Potential Representation. Overview. Chris Williams 1.

CSE 373: AVL trees. Warmup: Warmup. Interlude: Exploring the balance invariant. AVL Trees: Invariants. AVL tree invariants review

DUET WITH DIAMONDS COLOR SHIFTING BRACELET By Leslie Rogalski

Decimals DECIMALS.

CSE 373. Graphs 1: Concepts, Depth/Breadth-First Search reading: Weiss Ch. 9. slides created by Marty Stepp

CSC Design and Analysis of Algorithms. Example: Change-Making Problem

# 1 ' 10 ' 100. Decimal point = 4 hundred. = 6 tens (or sixty) = 5 ones (or five) = 2 tenths. = 7 hundredths.

MAT3707. Tutorial letter 201/1/2017 DISCRETE MATHEMATICS: COMBINATORICS. Semester 1. Department of Mathematical Sciences MAT3707/201/1/2017

16.unified Introduction to Computers and Programming. SOLUTIONS to Examination 4/30/04 9:05am - 10:00am

SEE PAGE 2 FOR BRUSH MOTOR WIRING SEE PAGE 3 FOR MANUFACTURER SPECIFIC BLDC MOTOR WIRING EXAMPLES EZ SERVO EZSV17 WIRING DIAGRAM FOR BLDC MOTOR

12. Traffic engineering

OpenMx Matrices and Operators

Planar Upward Drawings

COMP108 Algorithmic Foundations

Math 61 : Discrete Structures Final Exam Instructor: Ciprian Manolescu. You have 180 minutes.

An undirected graph G = (V, E) V a set of vertices E a set of unordered edges (v,w) where v, w in V

Walk Like a Mathematician Learning Task:

Aquauno Video 6 Plus Page 1

b. How many ternary words of length 23 with eight 0 s, nine 1 s and six 2 s?

S i m p l i f y i n g A l g e b r a SIMPLIFYING ALGEBRA.

QUESTIONS BEGIN HERE!

ICM7226A, ICM7226B. 8-Digit, Multi-Function, Frequency Counter/Timer. Features. Description. Applications. Ordering Information.

ICM7226A ICM7226B 8-Digit Multi-Function Frequency Counter/Timers

Solutions for HW11. Exercise 34. (a) Use the recurrence relation t(g) = t(g e) + t(g/e) to count the number of spanning trees of v 1

Basis of test: VDE 0660, part 500/IEC Rated peak withstand current I pk. Ip peak short-circuit current [ka] Busbar support spacing [mm]

ICM7216A, ICM7216B ICM7216D 8-Digit Multi-Function Frequency Counter/Timer

A Simple Code Generator. Code generation Algorithm. Register and Address Descriptors. Example 3/31/2008. Code Generation

Garnir Polynomial and their Properties

Paths. Connectivity. Euler and Hamilton Paths. Planar graphs.

Algorithmic and NP-Completeness Aspects of a Total Lict Domination Number of a Graph

The University of Sydney MATH2969/2069. Graph Theory Tutorial 5 (Week 12) Solutions 2008

Page 1. Question 19.1b Electric Charge II Question 19.2a Conductors I. ConcepTest Clicker Questions Chapter 19. Physics, 4 th Edition James S.

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

Using the Printable Sticker Function. Using the Edit Screen. Computer. Tablet. ScanNCutCanvas

Complete Solutions for MATH 3012 Quiz 2, October 25, 2011, WTT

SEE PAGE 2 FOR BRUSH MOTOR WIRING SEE PAGE 3 FOR MANUFACTURER SPECIFIC BLDC MOTOR WIRING EXAMPLES A

5/1/2018. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees. Huffman Coding Trees

Multipoint Alternate Marking method for passive and hybrid performance monitoring

Graph Isomorphism. Graphs - II. Cayley s Formula. Planar Graphs. Outline. Is K 5 planar? The number of labeled trees on n nodes is n n-2

d e c b a d c b a d e c b a a c a d c c e b

SAMPLE PAGES. Primary. Primary Maths Basics Series THE SUBTRACTION BOOK. A progression of subtraction skills. written by Jillian Cockings

Experiment # 3 Introduction to Digital Logic Simulation and Xilinx Schematic Editor

NO RECOMMENDED REPLACEMENT

Integration Continued. Integration by Parts Solving Definite Integrals: Area Under a Curve Improper Integrals

Numbering Boundary Nodes

5/7/13. Part 10. Graphs. Theorem Theorem Graphs Describing Precedence. Outline. Theorem 10-1: The Handshaking Theorem

V={A,B,C,D,E} E={ (A,D),(A,E),(B,D), (B,E),(C,D),(C,E)}

A Low Noise and Reliable CMOS I/O Buffer for Mixed Low Voltage Applications

Problem solving by search

Chem 104A, Fall 2016, Midterm 1 Key

Indices. Indices. Curriculum Ready ACMNA: 209, 210, 212,

learning objectives learn what graphs are in mathematical terms learn how to represent graphs in computers learn about typical graph algorithms

UNCORRECTED SAMPLE PAGES 4-1. Naming fractions KEY IDEAS. 1 Each shape represents ONE whole. a i ii. b i ii

Module 2 Motion Instructions

Section 3: Antiderivatives of Formulas

SOLVED EXAMPLES. be the foci of an ellipse with eccentricity e. For any point P on the ellipse, prove that. tan

N=4 L=4. Our first non-linear data structure! A graph G consists of two sets G = {V, E} A set of V vertices, or nodes f

COMPLEXITY OF COUNTING PLANAR TILINGS BY TWO BARS

Graphs. CSC 1300 Discrete Structures Villanova University. Villanova CSC Dr Papalaskari

12/3/12. Outline. Part 10. Graphs. Circuits. Euler paths/circuits. Euler s bridge problem (Bridges of Konigsberg Problem)

5/9/13. Part 10. Graphs. Outline. Circuits. Introduction Terminology Implementing Graphs

The University of Sydney MATH 2009

0.1. Exercise 1: the distances between four points in a graph

Binomials and Pascal s Triangle

Graphs. Graphs. Graphs: Basic Terminology. Directed Graphs. Dr Papalaskari 1


ATMOSPHERIC DISTURBANCE MONITOR MAIN CIRCUIT BOARD V5

10/30/12. Today. CS/ENGRD 2110 Object- Oriented Programming and Data Structures Fall 2012 Doug James. DFS algorithm. Reachability Algorithms

CS 461, Lecture 17. Today s Outline. Example Run

Lecture 20: Minimum Spanning Trees (CLRS 23)

The Plan. Honey, I Shrunk the Data. Why Compress. Data Compression Concepts. Braille Example. Braille. x y xˆ

CS150 Sp 98 R. Newton & K. Pister 1

EXAMPLE 87.5" APPROVAL SHEET APPROVED BY /150HP DUAL VFD CONTROL ASSEMBLY CUSTOMER NAME: CAL POLY SLO FINISH: F 20

Outline. Circuits. Euler paths/circuits 4/25/12. Part 10. Graphs. Euler s bridge problem (Bridges of Konigsberg Problem)

More Foundations. Undirected Graphs. Degree. A Theorem. Graphs, Products, & Relations

EE 209 Lab 3 Mind over Matter

CS 241 Analysis of Algorithms

Outline. Binary Tree

a b c cat CAT A B C Aa Bb Cc cat cat Lesson 1 (Part 1) Verbal lesson: Capital Letters Make The Same Sound Lesson 1 (Part 1) continued...

Similarity Search. The Binary Branch Distance. Nikolaus Augsten.

Exam 1 Solution. CS 542 Advanced Data Structures and Algorithms 2/14/2013

Yehuda Lindell Bar-Ilan University

Transcription:

ECE 367 - Exprimnt #4 Svn Smnt Disply Intrfin n Timin Sprin 2006 Smstr Introution This xprimnt rquirs tht you onstrut iruit intrfin th MiroStmp11 moul with svn smnt isply, n writ ssmly lnu o to ontinuously isply iml iit tht inrmnts xtly 1 on pr son. Rquir Hrwr In ition to th MiroStmp11 moul, this xprimnt rquirs on sinl-iit svn smnt LED isply n th 220Ω DIP rsistors. Hr r th iml iits 0 throuh 9 s isply on svn smnt isply: f CC f Th pinout irm on th lft is for th Lth UC5641-11 (Jmo #334879) svn smnt plus iml point LED isply tht is in your prts kit. Th two ommon tho (CC) trminls r ti to ll svn LEDs s shown low: CC CC f p p CC p 1 s trmin y th ury of th miroontrollr s mstr lok rystl osilltor

Wirin Dirm Buil th followin iruit on solrlss ror. Not tht PA7 n ll six its in PortD r onfiur to oprt s output lins: f f Ω CC Smpl iruit lyout for Lortory Exprimnt #4. Softwr Dsin First onsir th tsk of isplyin iml iit usin svn smnts. For xmpl, th wirin irm ov tlls us tht w n to hv th followin output t on PA7, PD5... PD0 in orr to isply iit 3 :

Output lin loil stt to isply 3 orrsponin smnt ll PA7 1 PD5 1 PD4 1 PD3 1 PD2 0 PD1 0 f PD0 1 f Assumin tht PA7, PD5... PD0 hv lry n onfiur to outputs, hr r fw lins of o tht will us 3 to isply: LDAA #$79 ; 7-smnt o for "3" STAA PortD,X ; snt to PD5...PD0 BSET PortA,X,$80 ; PA7<--1 (hih it of th 7-s o) (As usul, ristr X hs n initiliz to th strtin rss of th ristr lok n PortA/PortD lls hv n qut with thir rsptiv offst vlus.) Th sist wy to isply th iml iit whos vlu is in mmory vril Diit, for xmpl, is y usin squn of if/thn loks suh s this on: Chk_if_3: Chk_if_4: LDAA Diit CMPA #3 ; ompr Diit to th vlu 3 BNE Chk_if_4 LDAA #$79 ; sn 7-s. o for 3 to th output STAA PortD,X BSET PortA,X,$80 JMP Finish_Tsk (t.) Inrmntin th Disply Diit On Pr Son Now tht you know how to show iml iit on svn smnt isply vi, nxt w will nxt ovr th timin spts of this xprimnt. In prvious xprimnts ll lys wr hiv usin softwr loops, so it is nturl to onsir tkin th sm pproh hr. But w will tk this opportunity to lrn out spil susystm insi th Motorol 68HC11 miroontrollr th hrwr timr.

A softwr ly loop rquirs tht your o o th ountin, n nothin ls ts on in th mntim. A hrwr timr, on th othr hn, os th ountin for you whil th CPU (in ontroll y your prorm o) is fr to o othr thins. 16 it Timr Ristr TCNT Th 68HC11 hrwr timr TCNT hs 16 its n is onstntly ountin up in inry (ylin throuh 2 16 uniqu stts). It is ll fr-runnin ountr us it is lwys runnin inpnntly of wht th CPU is oin. TCNT my not initiliz, lr, nor my its ountin pross stopp. It ssntilly funtions s r-only 16 it ristr whos ontnts hn vry {1, 4, 8 or 16} mstr lok yls, pnin on how thins r onfiur. TCNT my onfiur to ount in on of four wys: TCNT Prslin Ftor N : Tim it tks TCNT to inrmnt on: Tim it tks TCNT to inrmnt 2 16 tims: 1 0.5 us = on lok prio 2 0.032768 s 4 2.0 us = four lok prios 0.131072 s 8 4.0 us = iht lok prios 0.262144 s 16 8.0 us = sixtn lok prios 0.524288 s For xmpl, w n hiv 0.25 s ly in ths four wys: Wit for TCNT to inrmnt 500,000 tims whn N = 1; Wit for TCNT to inrmnt 125,000 tims whn N = 4; Wit for TCNT to inrmnt 62,500 tims whn N = 8; Wit for TCNT to inrmnt 31,250 tims whn N = 16. Howvr, y sltin prslin ftor N so tht th numr of tims TCNT ns to inrmnt is lss thn 2 16 = 65,536 (th numr of stts in omplt ount yl), w rtly simplify th tsk of ttin whn th sir ly hs pss. Thus ithr N=8 or N=16 woul us to rliz 0.25 s ly. To minimiz miroontrollr powr onsumption on shoul lwys slow own th TCNT ountr s muh s possil (hoosin th lrst possil N), so th hoi of N=16 is st in th xmpl ov. Thr lso xist four Timr Output Compr ristrs TOC1 TOC4, whos 16-it ontnts r onstntly in ompr to th TCNT ountr stt. Whn hrwr tts tht TCNT hs inrmnt to vlu qul to tht stor in on of th TOC ristrs, thn orrsponin fl is st. 3 For xmpl, whn TCNT = TOC1 thn OC1F (Output Compr 1 Fl) oms st. 2 Sin th MiroStmp11 tht you hv purhs hs n intrnl lok ( E Clok ) frquny = 2 MHz 3 Also, hrwr intrrupt my trir or n output pin my m to hn stt. TCNT lon with its output ompr ristrs is on of th most usful susystms on th miroontrollr.

Th followin hrwr irm sris th intrtion twn TCNT, TOC1 n OC1F: TCNT qul? St TOC1 Q Rst flip-flop r OC1F writ OC1F utomtilly oms st whn TOC1 = TCNT, n only softwr writ oprtion n rst it. On must writ 1 to OC1F in orr to rst it; writin 0 hs no fft. Ths stps r tkn to rliz 0.25 s ly usin th TCNT timr susystm: ) onfiur 4 prslin ftor N = 16; ) r 5 th vlu of TCNT; ) 31,250 to this vlu n stor it in TOC1 6 ; ) lr OC1F 7 ; ) wit until OC1F = 1 (pollin this fl vry so oftn whil prformin othr tsks); f) th tsk tht hs n witin for th 0.25 s ly to pss. Usully th TCNT timr is us to trir xution of prtiulr tsk t uniform inrmnts of tim, suh s vry 0.25 s. In suh s on woul ppn th followin stps to thos ov: ) inrmnt th vlu of TOC1 y 31,250; h) jump to stp () Answr this qustion: why is stp () oin TOC1 TOC1 + 31,250 inst of TOC1 TCNT + 31,250? 4 PR1, PR0 1 in TMSK2 ristr; this must on within th first 64 lok yls ftr powr-on rst. 5 TCNT is t rsss Rs+[$0E,$0F] 6 TOC1 is t rsss Rs+[$16,$17] 7 OC1F = it 7 of TFLG1, foun t Rs+$23.

Th followin softwr flowhrt shows how TCNT my us to ontrol th timin of up to fiv tsks t on: on runnin most of th tim (Tsk0) n th othrs (Tsk1, Tsk2, Tsk3 n Tsk4) xutin only t rtin uniformly-sp tims 8 : Tsk0 OC1F = 1? no OC2F = 1? no OC3F = 1? no OC4F = 1? no Tsk1 Tsk2 Tsk3 Tsk4 offst1 to TOC1, rst OC1F offst2 to TOC2, rst OC2F offst3 to TOC3, rst OC3F offst4 to TOC4, rst OC4F In this xprimnt you will usin TCNT n TOC1 to only two tsks. Hr is simplifi flowhrt: Tsk0: isply Diit OC1F = 1? no Tsk1: upt Diit offst to TOC1, rst OC1F Tsk0: Disply mmory vlu Diit on 7-s. LED isply Tsk1 psuoo: ( vry 0.1 s) Count Count + 1 if (Count = 10) Count 0 Diit Diit + 1 if (Diit = 10) Diit 0 n if n if (initilly Count = 0, Diit = 0) 8 Assum tht th tim rquir to h tsk is muh shortr thn th lys ministr y TCNT

Th psuoo sription of Tsk1 shows th intr Count in inrmnt. Whn Count rhs 10 it is rst to 0, n thn intr Diit is inrmnt. Whn Diit rhs 10 it is rst to 0. Thus Count is iml ountr for tnths of son n Diit is iml ountr for sons. W o this is us TCNT yls too quikly (0.524 s t its slowst p) to irtly rliz 1.0 s ly tims. Finlly, hr is som usful o tht you my us for this l: 1. Dfinin mmory lls ($0040 - $00FF is RAM on th MiroStmp11): Count EQU $0040 ; RAM yt rss: tnth-of-s ountr Diit EQU $0041 ; RAM yt rss: isply iit vlu 2. Confiurin th ports n prslin ftor: LDAA #$01 ; PR1,PR0 <-- 0,1 STAA TMSK2,X ; (slow own TCNT y ftor 4) BSET PACTL,X,$80 ; onfiur PA7 s output BSET DDRD,X,$3F ; onfiur PD0-PD6 s outputs 3. Mnipultin Count s prt of Tsk1: INC Count LDAA Count CMPA #10 BNE Ll_1 ; if Count = 10, CLR Count ; thn rst it k to zro (t.) 4. Ain 1/10 s offst to TOC1 (Inr must qut with th offst vlu): LDD TOC1,X ADDD #Inr STD TOC1,X LDAA #$80 STAA TFLG1,X ; D <-- TOC1 ; D <-- D + Inr ; TOC1 <-- D ; Clr th TCNT Output Compr 1 fl Don t try to t vrythin workin t on in y isplyin th iit 8 on th 7 smnts. 9 This will hk oth your iruit wirin n orrtnss of port onfiurtion. Only thn pro to writin n uin th timin lorithm. All timin must on usin TCNT no softwr lys r llow. Dmonstrt th workin iruit to your T.A. 9 Don t isply 8 for vry lon s this miroontrollr is not rt to riv tht muh urrnt t on. To o it orrtly w shoul uffr th output lins for rivin th 7-s. LED isply (.. TTL invrtrs).