Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lab. 2 Overview – Earlier Tasks Prelaboratory T1, T3, T4 and T5

Similar presentations


Presentation on theme: "Lab. 2 Overview – Earlier Tasks Prelaboratory T1, T3, T4 and T5"— Presentation transcript:

1 Lab. 2 Overview – Earlier Tasks Prelaboratory T1, T3, T4 and T5
What concepts are you expected to understand after the Lab. 2 is finished? How do you demonstrate that you have that knowledge?

2 Show understanding of what concepts?
How to write up a “valid” (working) “C++” interrupt service routine for the timers on a microcontroller. How to set up a timer to be able to cause an interrupt. How to set-up the “C++” code to handle a new interrupt without crashing Demonstrate “multi-tasking” – a main program and a background “interrupt” routine Use a test driven development approach to demonstrate validation of the other concepts 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

3 To be tackled today Lab. 2 – Concepts to be understood and demonstrated
(Prelab) – Watch dog timer demo (Task 1) with C++ code rewritten in assembly code (Task 2 – prepare for Midterm)) (Prelab) – Write C++ code for interval timer (Task 3) and use with SMALLEST MOVIE SCREEN IN THE WORLD (Task 4) (Application stream only) – Flip a single code switch and display the movie on the LARGE MOVIE screen (Task 6). Uses a function library that you will develop yourselves in Lab. 4 (Application stream only) – Use the world war 1 technique employed by Snoopy to shoot down the Red Baron to improve the LARGE and SMALL movie screens (TASK 11) Setting up the test driven development environment for Lab. 2 which will be used for later tasks. (Task 5) 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

4 Lab. 2 Tasks 1 and 2 -- Play Video Game against the Watchdog Timer
See last Monday’s notes TASK 1 PURPOSE: Demonstrate the code necessary to initialize and then use of the "watch-dog" interrupt to regain control of an embedded system made uncontrollable by the need to wait for an external signal that can never arrive. TASK 1 PURPOSE: Demonstrate the building and use of a function library. TASK 2 PURPOSE: Demonstrate the replacement of a number of C++ functions to initialize and use an external peripheral by their equivalent assembly language functions. Practice for the midterm 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

5 Turning provided code into a “function library”
Make Lab2 project to build the standard executable – add provided code Make WatchDog Library project to build a library – add provided code Link the library into the Lab 2 project to be able to run Task 1 Modify the library to add your assembly code versions of the WatchDog Timer functions for Task 2 (Midterm practice) 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

6 Making a library project
11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

7 Adding a “library dependency” Automatic update of 2 projects
11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

8 Making a library project and an executable project “inter-dependent”
11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

9 Lab. 2 Tasks 3 and 4 – Smallest MOVIE shown using C++ interval timer
TASK 3 PURPOSE: Develop and test a C++ interval timer to control the operation of the "main task" within an embedded system. (Last Monday’s lecture) TASK 4 PURPOSE: Develop and test a "main task" that uses an interval timer to control external activities. This "main task" must continue "unaffected" by an interrupt driven task introduced later in the laboratory. APPLICATION STREAM ONLY TASK 6 and PURPOSE: Extend the ideas from Task 4 "for a little bit of fun". This "main task" makes use of a background interrupt driven task (Lab. 4) to control the display of an external device. 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

10 Small MOVIE in the world – white picture
This slide is brought to you by the letter “M” Pixels become activated as the electron gun “paints” the various pixels on the screen Repainted every 1/30 s Persistence of vision makes the letter appear “there all the time” 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

11 Small MOVIE in the world
This slide is brought to you by the letter “M” 7 rows of pixels Pixels become activated as the electron gun “paints” the various pixels on the screen Repainted every 1/30 s Persistence of vision makes it appear “there all the time” 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

12 Small MOVIE in the world
This slide is brought to you by the letter “M” 7 rows of pixels PRESS SW1 to clear screen and start the movie 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

13 Small MOVIE in the world -- speed controlled by C++ interval timer
This slide is brought to you by the letter “M” 7 rows of pixels MOVIE PROJECTOR Each time the “interval timer” rings (completes) display the next line 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

14 SMALLEST MOVIE IN THE WORLD –
This slide is brought to you by the letter “M” 1 row of pixels PRESS SW1 TO START 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

15 SMALLEST MOVIE IN THE WORLD – INTERVAL TIMER
This slide is brought to you by the letter “M” 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

16 ENOUGH PRESSES ALREADY
Tasks 5, 7 and onwards involve adding a background task (core timer interrupt) to make the smallest VCR in the world. Of course – no body knows how to program the VCR; so, to be realistic, you will just see is the “blinking light” (LED 6) indicating that the VCR is improperly programmed. In principle – you could make a “real VCR” by writing a function to store key presses and later play those stored key presses back (not particularly difficult but recommended only for application stream people with time on their hands) 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

17 L2 T4 – Code for the “MOVIE frame”
Displayed using WriteLEDASM( ) This slide is brought to you by the letter “A” 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

18 L2 T4 – Activate Movie Press SW1 to clear the screen
11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

19 Movie Code 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

20 L2 Displaying the movie 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

21 ERRORS AND DEFECTS Review (Post-lab1 and midterm)
TLD - Test last development Need a systematic way to ensure that those functions work now “Regression Testing” and a systematic way to ensure that they work in the future after modification “Defect free” development environment By discovering all the mistakes (called ERRORS) before developing any further code based on these functions we can ensure that no hidden mistakes (CALLED DEFECTS) are present Errors are easier, and less costly, to fix as you are in that part of the code where they have been introduced – you know where to look 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

22 L2 T5 – Setting up test environment Pre laboratory – before the lab.
This test environment is automated Makes it easy for you to run the tests often Many provided testing files that you can just download Only work if you have called the functions you develop exactly what is specified in the web pages Imagine that this is in industry, and you are working with a colleague (“me”) as part of the team. This is meant to be a supportive relationship. Expect an occasional typo in the test or test documentation. These occur when I make some minor changes to the pages during the laboratory development. Get a model in your head of what is “supposed to happen next”. That model will often get you past an apparent road block in the web pages 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

23 L2 T5 – Setting up test environment
I will be providing you with project files to download (.prj) to download and automatically link to your code and tests Works best if you have called the files you develop exactly the names that are specified in the web pages. There are simple “work arounds” supplied by the VisualDSP tool functionality to overcome the problem where you have not called the files by the same names (or placed in the right directory) Simple errors like this would be fairly common in industry when working with a team. Learn to use this useful VDSP feature. 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

24 Required LAB Directory Environment
11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

25 Required Files for “regression testing” of From Lab. 1 functions
11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

26 Required Files – Lab2 and Lab2Tests -- Init_CoreTimer06ASM tests
11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

27 First test – can we link to the test
11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

28 Write a test to check stub works Init_CoreTimer06ASM( )
11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

29 Recap of what has been discussed Prelaboratory T1, T3, T4 and T5
Download the "Watchdog Timer" Video Game T1 - Video Game Do not do Task 2 as part of Lab. 2 pre-laboratory exercises Generate and use your ASM functions to control WatchDog interrupts T2 - My WatchDog Control Functions Task 2 is meant as a practice exercise for the Midterm Exam Build a simple timer T3 --Non interrupt driven timer Watch a movie T4 - on a small movie screen Setting up E-TDD environment (Assignment 1 and 2) T5 - Automated tests for Lab. 2 Application stream only tasks (not prelab) Watch a sailing movie  T6 - using a LARGE movie screen Watch a sailing movie with the help of the T11 -- Snoopy and Red Baron 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada

30 Show understanding of the following concepts during Lab. 2?
How to write up a “valid” (working) “C++” interrupt service routine for the timers on a microcontroller. How to set up a timer to be able to cause an interrupt. How to set-up the “C++” code to handle a new interrupt without crashing Demonstrate “multi-tasking” – a main program and a background “interrupt” routine Use a test driven development approach to demonstrate validation of the other concepts 11/10/2018 TDD-Core Timer Library, Copyright M. Smith, ECE, University of Calgary, Canada


Download ppt "Lab. 2 Overview – Earlier Tasks Prelaboratory T1, T3, T4 and T5"

Similar presentations


Ads by Google