Lab 3 Details
description
Transcript of Lab 3 Details
![Page 1: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/1.jpg)
Lab 3 Details
![Page 2: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/2.jpg)
Lab 3
• Develop a bio-feedback system based on a PWM (pulse width modulated) thermal sensor
• Use temperature setting to control the delays in an audio signal so that ‘stereo music’ seems to move across your head (left to right) in response to thermal changes
![Page 3: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/3.jpg)
End of Lab. 2
![Page 4: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/4.jpg)
Demonstration of bio-feedback operation using a ‘Mock’ temperature sensor
![Page 5: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/5.jpg)
Build and test mock (fake) temperature device
![Page 6: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/6.jpg)
Reminder of how to test a TTCOs task
Design the task state diagram
![Page 7: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/7.jpg)
Develop Basic Test forFlashLED6 “working”
![Page 8: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/8.jpg)
Write the code to satisfy the Tests
![Page 9: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/9.jpg)
Defects• The number of syntax errors you did not see
IS A PROXY FOR
• The number of logical errors present in your code
• DO A PROPER CODE REVIEW
![Page 10: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/10.jpg)
Don’t ignore ANY compiler warning messages
![Page 11: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/11.jpg)
Why is a warning message such a big deal?
![Page 12: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/12.jpg)
“crewOkay = true” is always true so ‘Customer release’ removes code
![Page 13: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/13.jpg)
Back to Lab. 3
• If this works – then when you get your thermal sensor working (and writing into the global variable roomTemperature), then your bio-feedback device will operate
![Page 14: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/14.jpg)
Handling key-presses and timing
![Page 15: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/15.jpg)
Better solution?
• If there is no change in the Switch centre, then increment a counter each time the FlashRateLED5_SW3( ) is called
• More technical solution – read the clock cycle register (Assignment 1). However, does the increased accuracy (and increased coding time) actual give the customer a better solution
![Page 16: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/16.jpg)
Displaying the temperature(Mock now, true later)
• Led5 and LED6 continue flashing when SW1 is released
![Page 17: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/17.jpg)
Temperature sensor
• Task 1 – accurately determine the PWM values of the thermal sensor using input and place values in T1_Low and T2_High global variables
• Task 2 – Use T1_Low and T2_High global variables to calculate temperature
• Task 3 and 4 – Display temperature and do bio-feedback task
![Page 18: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/18.jpg)
Design and test CalculateTemperature function BEFORE making TTCOS task
![Page 19: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/19.jpg)
TMP03 Thermal sensor
![Page 20: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/20.jpg)
Check that sensor still works
![Page 21: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/21.jpg)
Low accuracy measurement of T1 and T2 (80% of Lab 3 complete)
![Page 22: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/22.jpg)
![Page 23: Lab 3 Details](https://reader035.fdocuments.in/reader035/viewer/2022062314/56813d54550346895da70f1e/html5/thumbnails/23.jpg)
Design part of Lab. 3 using General Purpose timer
Will need to read up in the Blackfin Processor Hardware Manual