4 Pages

Lab 05 - Stoplight

Course: CS 124, Winter 2012
School: BYU
Rating:
 
 
 
 
 

Word Count: 452

Document Preview

5: Lab Stoplight Lab Lab 5: Stoplight Program an assembly, callee-save, timer subroutine that executes (delays) in variable increments of 1/10 second. Use the timing subroutine to program timing delays for a simple traffic stoplight. 6 Turn on the green LED for 5 seconds. Blink the green LED on and off at 1 second intervals for seconds (3 offs and 3 ons). Blink the green LED on and off at 0.2 second...

Register Now

Unformatted Document Excerpt

Coursehero >> Utah >> BYU >> CS 124

Course Hero has millions of student submitted documents similar to the one
below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.

Course Hero has millions of student submitted documents similar to the one below including study guides, practice problems, reference materials, practice exams, textbook help and tutor support.
5: Lab Stoplight Lab Lab 5: Stoplight Program an assembly, callee-save, timer subroutine that executes (delays) in variable increments of 1/10 second. Use the timing subroutine to program timing delays for a simple traffic stoplight. 6 Turn on the green LED for 5 seconds. Blink the green LED on and off at 1 second intervals for seconds (3 offs and 3 ons). Blink the green LED on and off at 0.2 second intervals seconds (10 offs and 10 ons). for 4 And finally, turn the green LED off (and the red LED on) for 10 seconds. The total traffic light cycle time should be 25 seconds (plus or minus 1/2 second). Repeat the stoplight cycle indefinitely. BYU CS/ECEn 124 Stoplight Lab 1 Lab 5: Stoplight Lab Blink the green LED on and off at 1 second intervals for 6 seconds (3 offs and 3 ons). Lab 5: Stoplight Turn on the green LED for 5 seconds. Blink the green LED on and off at 0.2 second intervals for 4 seconds (10 offs and 10 ons). And finally, turn the green LED off (and the red LED on) for 10 seconds. ON 5 1 1 1 1 1 1 1 1 1 1 10 OFF BYU CS/ECEn 124 The total traffic light cycle time should be 25 seconds ( 1/2 second). Stoplight Lab 2 Stoplight Lab DELAY RESET: .cdecls C,LIST,"msp430.h" .equ (50/8) .text mov.w mov.w bis.b xor.b call jmp push.w push.w mov.w dec.w jeq mov.w dec.w jnz jmp pop.w pop.w ret #0x0280,SP #WDTPW+WDTHOLD,&WDTCTL #0x01,&P1DIR #0x01,&P1OUT #delay1sec r12 mainloop r15 #DELAY,r12 r12 delay06 #0,r15 r15 delay04 delay02 r15 r12 ; MSP430 ; ; ; ; Lab 5: Stoplight beginning of code init stack pointer stop WDT set P1.0 as output mainloop: ; toggle P1.0 delay1sec: ; callee-save Save all registers used in subroutine ; get delay count ; done? ; y, return ; n, use R15 as delay counter ; delay over? ; n ; y ; delay02: delay04: delay06: Restore registers at restore registers end of subroutine .sect ".reset" .word RESET BYU CS/ECEn 124 .end Stoplight Lab ; MSP430 RESET Vector ; start address 3 Lab 5: Stoplight Lab Lab 5: Stoplight 2 points All software delays are implemented using a 1/10 second delay assembly subroutine. The subroutine is implemented using a callee-save protocol. 2 points The assembler directive .equ is used to define all delay counts and constants. 4 points Your traffic stoplight machine works as specified. That is, the green LED is on for 5 seconds. The green LED blinks on and off at 1 second intervals for 6 seconds (3 offs and 3 ons). Then the green LED blinks on and off at 0.2 second intervals for 4 seconds (10 offs and 10 ons). And finally, the green LED is turned off (and the red LED on) for 10 seconds. 2 points The total traffic light cycle time is 25 seconds with less than a 1/2 second error. +1 point timing The number of 1/10 second delays is passed to the subroutine on the stack. Stoplight Lab 4 BYU CS/ECEn 124
Find millions of documents on Course Hero - Study Guides, Lecture Notes, Reference Materials, Practice Exams and more. Course Hero has millions of course specific materials providing students with the best way to expand their education.

Below is a small sample set of documents:

BYU - CS - 124
Lab 6a - Morse Code LabnLab 6a: Morse Codenn n n nWrite an MSP430 assembly program that communicates a message in Morse Code using an LED and a transducer (magnetic speaker). Write a Watchdog Interrupt Service Routine (ISR)Configure the watchdog as
BYU - CS - 124
Lab 7a Dice Roller"Write a dice roller C program that waits for a switch to be pressed and then displays two dice which randomly change values. The dice roll begins rapidly and progressively slows down until it stops (after approximately 3-5 seconds). A
BYU - CS - 124
Chapter 5SLAU132C November 2008MSP430 C/C+ Language ImplementationThe C/C+ compiler supports the C/C+ language standard that was developed by a committee of the American National Standards Institute (ANSI/ISO) to standardize the C programming language.
BYU - CS - 124
www.ti.comInterfacing C and C+ With Assembly Language6.4.3 Accessing Arguments and Local VariablesA function accesses its local nonregister variables indirectly through the stack pointer (SP or R1) and its stack arguments. The SP always points to the t
Stanford - CS - 243
CS 243Assignment 1Assignment 1Dataow AnalysisDue: January 25, 11:00 amThis is a written assignment, every student must hand in his or her homework.Bring your homework to class on January 25. SCPD students may submit theirhomework by e-mail via scpd
Stanford - CS - 243
HW4:Finding Redundant Null Checks and Extra CreditCS 243, Winter 2010-2011CarnegieCarnegie MellonCS243: Joeq Framework1Null ChecksImplicit in Java bytecodeExplicit in QuadsThere can be many redundant onesCarnegie Mellon2#Reasons for Redundan
Stanford - CS - 243
Joeq FrameworkCS 243, Winter 2010-2011CarnegieCarnegie MellonCS243: Joeq Framework1Homework 2: Dataflow FrameworkSolver interface Represent iterative dataflow algorithm Used for multiple dataflow analysesAnalysis interface Specify per-analysis
Stanford - CS - 243
Lecture 1IntroductionI. Why Study Compilers?II. Course SyllabusChapters 1.1-1.5, 8.4, 8.5, 9.1Carnegie MellonM. LamCS243: Introduction1I. Why Study Compilers?Carnegie MellonCS243: Introduction2M. LamReasons for Studying CompilersCompilers a
Stanford - CS - 243
Lecture 1IntroductionI. Why Study Compilers?II. Course SyllabusChapters 1.1-1.5, 8.4, 8.5, 9.1Carnegie MellonM. LamCS243: Introduction1I. Why Study Compilers?Carnegie MellonCS243: Introduction2M. Lam1Reasons for Studying CompilersCompilers
Stanford - CS - 243
SecuringWebApplicationswithInformationFlowTrackingwith Michael Martin, Benjamin Livshits, John Whaley,Michael Carbin, Dzin Avots, Chris UnkelWebApplicationVulnerabilities 500atabaseshadasecuritybreach[Computercrime&securitysurvey,2002] 92%Webapplic
Stanford - CS - 243
Lecture 2Introduction to Data Flow AnalysisI .IntroductionII. Example: Reaching definition analysisIII.Example: Liveness analysisIV. A General Framework(Theory in next lecture)Reading: Chapter 9.2Carnegie MellonM. LamCS243: Intro to Data Flow1
Stanford - CS - 243
Lecture 2Introduction to Data Flow AnalysisI .IntroductionII. Example: Reaching definition analysisIII.Example: Liveness analysisIV. A General Framework(Theory in next lecture)Reading: Chapter 9.2Carnegie MellonM. LamCS243: Intro to Data Flow1
Stanford - CS - 243
Lecture 3Foundation of Data Flow AnalysisIIIIIIIVSemi-lattice (set of values, meet operator)Transfer functionsCorrectness, precision and convergenceMeaning of Data Flow SolutionReading: Chapter 9.3Carnegie MellonI. Purpose of a FrameworkPurpo
Stanford - CS - 243
Lecture 4More on Data Flow:Constant Propagation, Speed, LoopsI. Constant PropagationII. Efficiency of Data Flow AnalysisIII. Algorithm to find loopsReading: Chapter 9.4, 9.6Carnegie MellonM. LamCS243: Constants, Speed, Loops1I. Constant Propaga
Stanford - CS - 243
Lecture 4More on Data Flow:Constant Propagation, Speed, LoopsI. Constant PropagationII. Efficiency of Data Flow AnalysisIII. Algorithm to find loopsReading: Chapter 9.4, 9.6Carnegie MellonM. LamCS243: Constants, Speed, Loops1I. Constant Propaga
Stanford - CS - 243
Lecture 5Partial Redundancy EliminationI. Forms of redundancyglobal common subexpression eliminationloop invariant code motionpartial redundancyII. Lazy Code Motion AlgorithmMathematical concept: a cut setBasic technique (anticipation)3 more pass
Stanford - CS - 243
Lecture 5Partial Redundancy EliminationI. Forms of redundancyglobal common subexpression eliminationloop invariant code motionpartial redundancyII. Lazy Code Motion AlgorithmMathematical concept: a cut setBasic technique (anticipation)3 more pass
Stanford - CS - 243
Lecture 6Register AllocationI. IntroductionII. Abstraction and the ProblemIII. AlgorithmReading: Chapter 8.8.4Before next class: Chapter 10.1 - 10.2Carnegie MellonM. LamCS243: Register Allocation1I. MotivationProblem Allocation of variables (
Stanford - CS - 243
Lecture 6Register AllocationI. IntroductionII. Abstraction and the ProblemIII. AlgorithmReading: Chapter 8.8.4Before next class: Chapter 10.1 - 10.2Carnegie MellonM. LamCS243: Register Allocation1I. MotivationProblem Allocation of variables (
Stanford - CS - 243
Lecture 7Instruction SchedulingI. Basic Block SchedulingII. Global Scheduling (for Non-Numeric Code)Reading: Chapter 10.3 10.4Carnegie MellonM. LamCS243: Instruction Scheduling1Scheduling Constraints Data dependences The operations must generat
Stanford - CS - 243
Lecture 7Instruction SchedulingI. Basic Block SchedulingII. Global Scheduling (for Non-Numeric Code)Reading: Chapter 10.3 10.4Carnegie MellonM. LamCS243: Instruction Scheduling1Scheduling Constraints Data dependences The operations must generat
Stanford - CS - 243
Lecture 8Software PipeliningI .IntroductionII. Problem FormulationIII.AlgorithmReading: Chapter 10.5 10.6Carnegie MellonM. LamCS243: Software Pipelining1I. Example of DoAll Loops Machine: Per clock: 1 read, 1 write, 1 (2-stage) arithmetic op,
Stanford - CS - 243
Lecture 8Software PipeliningI .IntroductionII. Problem FormulationIII.AlgorithmReading: Chapter 10.5 10.6Carnegie MellonM. LamCS243: Software Pipelining1I. Example of DoAll Loops Machine: Per clock: 1 read, 1 write, 1 (2-stage) arithmetic op,
Stanford - CS - 243
Lecture 9Dynamic CompilationI.! Motivation & BackgroundII.! OverviewIII.! Compilation PolicyIV.! Partial Method CompilationV.! Partial Dead Code EliminationVI.! Escape AnalysisVII.! ResultsPartial Method Compilation UsingDynamic Profile Informat
Stanford - CS - 243
Lecture 10Pointer Analysis1. Datalog2. Context-insensitive, flow-insensitive pointer analysis3. Context sensitivityReadings: Chapter 12Advanced CompilersM. Lam & J. WhaleyPointer Analysis toImprove Security Top web application security vulnerabi
Stanford - CS - 243
Lecture 10Pointer Analysis1. Datalog2. Context-insensitive, flow-insensitive pointer analysis3. Context sensitivityReadings: Chapter 12Advanced CompilersM. Lam & J. WhaleyPointer Analysis toImprove Security Top web application security vulnerabi
Stanford - CS - 243
CS 243Lecture 11Binary Decision Diagrams (BDDs)in Pointer Analysis1. Datalog BDD2. BDDs3. Context-Sensitive Pointer Analysis4. Performance of BDD AlgorithmsReadings: Chapter 12Advanced CompilersM. Lam & L11. BDDsJ. WhaleyAutomatic Analysis Gen
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSEC372 Economics of Bond and Derivatives MarketsEmpirical testing of the Black-Scholes ModelThe Black-Scholes model should, in principle, be straightforward to apply empirically because unlike many models
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSEC372 Economics of Bond and Derivatives MarketsCredit Default Swaps1.Credit Default Swaps: basic ideasJust as for any OTC contract, the terms of a Credit Default Swap, CDS, are at the discretionof the p
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSSession 201112R. E. BaileyEC372 Economics of Bond and Derivatives MarketsExercise 1: Bond Markets and Fixed Interest Securities1. Dene the yield to maturity on a coupon-paying bond with n years to maturi
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSSession 201112R. E. BaileyEC372 Economics of Bond and Derivatives MarketsExercise 2: Futures Markets: I Basic Ideas1. Suppose that the spot price of soya-beans today is $80 per bushel and that the forwar
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSSession 201112R. E. BaileyEC372 Economics of Bond and Derivatives MarketsExercise 3: Futures Markets: II Speculation and Hedging1. A company seeks to reduce the price risk associated with acquiring 1,000
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSSession 201112R. E. BaileyEC372 Economics of Bond and Derivatives MarketsExercise 4: Futures Markets: III Applications1. Your company has arranged to borrow 5m for six months beginning today. The interes
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSSession 201112R. E. BaileyEC372 Economics of Bond and Derivatives MarketsExercise 5: Options Markets: I Fundamental ideas1. Derive the lower bound for a European style call option premium:c max 0, S X
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSSession 201112R. E. BaileyEC372 Economics of Bond and Derivatives MarketsExercise 6: Options Markets: II Price determination1. Suppose that the current price of a stock is 120 pence per share and that th
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSSession 201112R. E. BaileyEC372 Economics of Bond and Derivatives MarketsExercise 8: Swap Contracts and Swap Markets1. (Plain vanilla interest rate swap.) Companies A and B both plan to borrow 15m for 7-
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSSession 201112R. E. BaileyEC372 Economics of Bond and Derivatives MarketsExercise 9: Financial Intermediation, I1. Identify the main motives for, and risks associated with, securitisation of assets for (
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSSession 201112R. E. BaileyEC372 Economics of Bond and Derivatives MarketsExercise 10: Financial Intermediation, II1. In the HT model with xed investment:(a) Show that if A = A, then Rf = B /p.[Hint: us
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSEC372 Economics of Bond and Derivatives MarketsNominal Bonds, Real Bonds and Expected InationThis note uses zero-coupon (ZC) bonds to explore the so-called Fisher relationship between ratesof return and t
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSEC372 Economics of Bond and Derivatives MarketsShort HedgingExample of risky hedging (i.e., realistic, imperfect hedging)In February (today) a farmer, A, plans to sell 50,000 bushels of wheat in November,
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSEC372 Economics of Bond and Derivatives MarketsLongevity Swaps an Emerging MarketAs with most swap contracts, a longevity swap comprises the exchange of a xed sequence of payments for a oating sequence. Wh
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSEC372 Economics of Bond and Derivatives MarketsMultiple Choice TestSpring Term 2010 Time allowed: 40 minutes. There are TWENTY questions, ALL of which should be answered. DO NOT START UNTIL YOU ARE ASKE
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSEC372 Economics of Bond and Derivatives MarketsMultiple Choice TestSpring Term 2011 Time allowed: 40 minutes. There are TWENTY questions, ALL of which should be answered. DO NOT START UNTIL YOU ARE ASKE
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSEC372 Economics of Bond and Derivatives MarketsMultiple Choice TestSpring Term 2012 Time allowed: 40 minutes. There are TWENTY questions, ALL of which should be answered. DO NOT START UNTIL YOU ARE ASKE
Uni. Essex - EC - 372
University of EssexDepartment of EconomicsEC372 Economics of Bond and Derivatives MarketsMultiple Choice Test Answer SheetFamily name:Given name(s):(BLOCK CAPITALS)Registration number:Mark your choice withX in one box per question1ABCD2AB
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSEC372 Economics of Bond and Derivatives MarketsBounds on Option PricesA Common Method of Proof1. Make a proposition, A.2. Suppose the contrary, i.e. not-A.3. Show that not-A permits an arbitrage opportu
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSEC372 Economics of Bond and Derivatives MarketsOption PricingHow to Derive an Option Price Formula1. Make assumptions, most importantly about: (i) frictionless markets, (ii) about determination of the und
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSEC372 Economics of Bond and Derivatives MarketsAmerican and European Put Option PremiumsThis note seeks to clarify why the price (premium) of an American put option almost alwaysexceeds that of a European
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSThe Strange Case of Socit Gnrale & Mr KervielThis note originally prepared in February 2008 discusses the aspects of the SocGen scandal relevant forEC372, keeping in mind that the case has yet to be fully
Uni. Essex - EC - 372
Paris le XX January 2008Explanatory note about the exceptional fraudParis, January 27th 2008The present document describes the arbitrage activities, the method behindthe fraud, the conditions in which the fraud was uncovered, the unwinding ofthe frau
Uni. Essex - EC - 372
U NIVERSITY OF E SSEXD EPARTMENT OF E CONOMICSTerm Structure of Interest RatesYield curvesYield curves show the relationship between spot yield and time to maturity (i.e. life) ofa bond.Spot yield: yn,t (m/pn,t )(1/n) 1 is the yield to maturity on a
Uni. Essex - EC - 372
EC372 Bond and Derivatives MarketsTopic #0: IntroductionR. E. BaileyDepartment of EconomicsUniversity of EssexOutlineContents1Lectures and Classes12Topics23Assessment24Recommended study strategy21Lectures and ClassesLectures and class
Uni. Essex - EC - 372
EC372 Bond and Derivatives MarketsIntroductionR. E. BaileyDepartment of EconomicsUniversity of EssexUniversity week 16EC372 Bond and Derivatives MarketsIntroductionTopic #0Outline1Lectures and Classes2Topics3Assessment4Recommended study s
Uni. Essex - EC - 372
EC372 Bond and Derivatives MarketsTopic #1: Bond Markets & Fixed Interest SecuritiesR. E. BaileyDepartment of EconomicsUniversity of EssexOutlineContents1Bonds and bond markets12Zero-coupon (ZC) bonds32.133Real ZC bonds . . . . . . . . . .
Uni. Essex - EC - 372
EC372 Bond and Derivatives MarketsBond Markets & Fixed Interest SecuritiesR. E. BaileyDepartment of EconomicsUniversity of EssexUniversity week 16EC372 Bond and Derivatives MarketsBonds MarketsTopic #1Outline1Bonds and bond markets2Zero-coupo
Uni. Essex - EC - 372
EC372 Bond and Derivatives MarketsTopic #2: Futures Markets I: Basic IdeasR. E. BaileyDepartment of EconomicsUniversity of EssexOutlineContents1Forward and futures contracts11.1Futures contracts . . . . . . . . . . . . . . . . . . . . . . . . .
Uni. Essex - EC - 372
EC372 Bond and Derivatives MarketsFutures Markets I: Basic IdeasR. E. BaileyDepartment of EconomicsUniversity of EssexUniversity week 17EC372 Bond and Derivatives MarketsFutures Markets ITopic #2Outline1Forward and futures contractsFutures con
Uni. Essex - EC - 372
EC372 Bond and Derivatives MarketsTopic #3: Futures Markets II: Speculation and HedgingR. E. BaileyDepartment of EconomicsUniversity of EssexOutlineContents1Speculation12Hedging strategies22.13Perfect (risk-free) hedging . . . . . . . . . .
Uni. Essex - EC - 372
EC372 Bond and Derivatives MarketsFutures Markets II: Speculation and HedgingR. E. BaileyDepartment of EconomicsUniversity of EssexUniversity week 18EC372 Bond and Derivatives MarketsFutures Markets IITopic #3Outline1Speculation2Hedging strat
Uni. Essex - EC - 372
EC372 Bond and Derivatives MarketsTopic #4: Futures Markets III: ApplicationsR. E. BaileyDepartment of EconomicsUniversity of EssexOutlineContents1Weather futures12Financial futures contracts23Short-term interest rate futures33.14A short
Uni. Essex - EC - 372
EC372 Bond and Derivatives MarketsFutures Markets III: ApplicationsR. E. BaileyDepartment of EconomicsUniversity of EssexUniversity week 19EC372 Bond and Derivatives MarketsFutures Markets IIITopic #4Outline1Weather futures2Financial futures