Presentation is loading. Please wait.

Presentation is loading. Please wait.

Developing Tasks to use with a co-operative scheduler Ideas for Assignment 2 Lab. 2, 3 and 4 Review for Midterm on Lab. 2 Ideas of defects, errors and.

Similar presentations


Presentation on theme: "Developing Tasks to use with a co-operative scheduler Ideas for Assignment 2 Lab. 2, 3 and 4 Review for Midterm on Lab. 2 Ideas of defects, errors and."— Presentation transcript:

1 Developing Tasks to use with a co-operative scheduler Ideas for Assignment 2 Lab. 2, 3 and 4 Review for Midterm on Lab. 2 Ideas of defects, errors and code review

2 Example Switch Tasks for Lab. 3 LED 6 is kept flashing at a rate = about your heart rate LED5 Flash rate is controlled by switch 3. (1) Long press slows down flash rate (2) short press speeds it up (3) accidental press – does nothing. (4) Demonstrate killing and re-launching of TTCOS tasks. NOT PART OF LAB 3 – used as demo -- Audio volume is controlled by switch 2. (1) Long press slower volume (2) short press higher volume (3) accidental press – does nothing. Switch 1 causes display of the temperature ( temperature - 20C) on the lower 4 LEDs when pressed. If not pressed show flashing lights – race to right if temperature increasing, race to left if temperature decreasing. Flash gently if temperature steady (less than 2C change in last 10 seconds. Input (PF11) is NO LONGER used for MANUAL switch sensing. Instead it is used to bring the input of the thermal sensor into the Blackfin

3

4 Audio_Volume_SW2 Task STATES While SW2 not pressed –stay in STATE_NOT_PRESSED, Set SW2_counter = 0; When SW2 pressed –Start SW2 counter, Move to STATE_PRESSED_NOT_RELEASED While SW2 not released –Increment counter, Stay in STATE_PRESSED_NOT_RELEASED When SW2 released –Stop counter, Move to STATE_JUST_RELEASED In STATE_JUST_RELEASED –Check if count is very small, -- no nothing –If count small (decrease volume) else increase volume –Move to STATE_NOT_PRESSED

5

6 Lab 3 – Bio-feedback Should be LED 5 AudioFeedback ISR Call back routine Concept – Plan to cut down number of tasks in 2013

7 Lab. 4 Use SPI interface, cause the words “Happy 511 Christmas” to appear on the LCD screen (60%) Manual version done Possibly during Class tutorial so be prepared (40%) 3/20/2016SPI and LCD, Copyright M. Smith, ECE, University of Calgary, Canada 7 / 30

8 Lab. 4 -- LCD interface Full SPI controller Note – Occurring in class time after Midterm and not lab time

9

10 LCD Setup and Usage control States See Lab 4 notes for more details

11 Some of the requirements for Lab 3 Should be LED 5

12 Design the task state diagram

13 Develop Basic Test for FlashLED6 “working”

14 Build Test -- Tells us what functions need developing ‘Quick fix’ to use new function names without having to change Lab 1 names Re-factor later (Feb 2011)

15 Write “enough” code to satisfy the Tests Why is using ‘current state’ better than reading current LED values? Are there ‘defect’s” in this code

16 [ What are the “syntax” errors in Flash6( )? Ignore “logical errors” at this time ] A.[In lines 16 to 20] B.[In lines 21 to 24] C.[In lines 25 to 28] D.[In lines 29 to 32] E.[In lines 33 to 36 ] [Default] [MC Any] [MC All]

17 Midterm / Quiz 3 / Final Review Code Defects The number of syntax errors you did not find before compiler – meaning the ones the compiler found after your code review IS A PROXY FOR The number of logical defects STILL present in your code DO A PROPER CODE REVIEW

18 [ What are the “logical” defects? Only the defects that would cause this simple Test to fail ] A.[ In lines 16 to 20] B.[In lines 21 to 24] C.[In lines 25 to 28] D.[In lines 29 to 32] E.[In lines 33 to 36]

19 Running the TEST

20 Identify the defect -- This is NOT a syntax error as compiler worked Each time this function “starts” currentState is reset to STATE1_ON 3 defects as well

21 Develop Basic Test for FlashLED6 “working properly” DO CODE REVIEW This test worries about requirement that other LED’s not impacted by FlashLED6

22 [Do Code review Where are the “syntax errors”] A.[31  33] B.[35  37] C.[42  45] D.[47  48] E.[50  53] The number of syntax errors you did not find before compiler – meaning the ones the compiler found after your code review IS A PROXY FOR the number of logical defects STILL present in your code

23 4 LOGICAL ERRORS

24 [Why are the tests failing? Choose best answer A.[System does not know what it is doing] B.[LED 6 is on, when it should be off] C.[LED 6 is off, when it should be on] D.[InitFlashCPP( ) and InitFlashPortCPP( ) not called] E.[All of above]

25 The FIX to start in state2 causes earlier tests to fail

26 When we call “FlashLED6 ( )” – the result depends on what happened before If another test has activated 3 FlashLED( ), then the Test passes. But if another test has activated 4 FlashLED( ), the test fails Slide shows initialization of FlashLED6 and fixed tests to use the new function

27 The problems with SimpleTest work – but destroy other states currentLED6 is now a global variable

28 Fix the code But it still fails

29 [Where does the problem remain?] A.[Outside this code] B.[In Lines 28  30] C.[Logic of State1] D.[InitFlashCPP( ) and InitFlashPortCPP( ) not called] E.[Logic of State 2]

30 Init Flash6, Run the Flash 6 task and destroy it after 20 seconds

31 Slightly different task in Lab3 Write tests to u se SW3 to change LED5 flash rate If switch 3 ‘accidently’ touched – do nothing to LED5 flash rate If switch 3 is held and released after a ‘short’ time, then decrease flash rate each time released If switch 3 is held and released after a ‘long’ time, then increase flash rate each time released


Download ppt "Developing Tasks to use with a co-operative scheduler Ideas for Assignment 2 Lab. 2, 3 and 4 Review for Midterm on Lab. 2 Ideas of defects, errors and."

Similar presentations


Ads by Google